12-11-2022 04:00 AM
Hi,
I need to amend some data for a specific table flowing through one of my pipelines
This specific json contains multiple values for example:
L_TYPE “A”
L_TYPE “A”
L_TYPE “A”
L_TYPE “B”
L_TYPE “B”
L_TYPE “B”
L_TYPE “C”
L_TYPE “C”
L_TYPE “C”
L_TYPE “D”
L_TYPE “D”
L_TYPE “D”
Firstly what I need to do is remove all but ONE of the L_TYPE “C”’s and ALL of the L_TYPE “D” records
Once that has been achieved I need to edit the data within the remaining L_TYPE “C”
L_TYPE “C”
ID: 1
Value: 33
Date: XX XX XX
What I need to do with the single remaining L_TYPE “C” is make the value data match the id data
any help would be very much appreciated
12-12-2022 05:04 PM
Hi Sir Barry,
Good day, I would suggest to use match for string comparison the return will be an array of string then you can dedups the array to get the unique
sl.ensureArray(“L_TYPE “A”\r\nL_TYPE “A”\r\nL_TYPE “A”\r\nL_TYPE “B”\r\nL_TYPE “B”\r\nL_TYPE “B”\r\nL_TYPE “C”\r\nL_TYPE “C”\r\nL_TYPE “C”\r\nL_TYPE “D”\r\nL_TYPE “D”\r\nL_TYPE “D””.match(/L_TYPE “C”/gm)).filter((a,b,c)=> c.indexOf(a) == b).join()