05-19-2020 03:05 AM
Hi,
I want to check the value of Description in each item in the below JSON and route seperately if all are same and seperately if they’re different. How can I do this?
[
{
“SEGMENT1”: “104155”,
“DESCRIPTION”: “EUR”,
“UNIQUE_ID”: “224”,
“ITEM_NUMBER”: “0113”
},
{
“SEGMENT1”: “104154”,
“DESCRIPTION”: “AED”,
“UNIQUE_ID”: “224”,
“ITEM_NUMBER”: “0103”
},
{
“SEGMENT1”: “104153”,
“DESCRIPTION”: “USD”,
“UNIQUE_ID”: “224”,
“ITEM_NUMBER”: “0090”
},
{
“SEGMENT1”: “104153”,
“DESCRIPTION”: “USD”,
“UNIQUE_ID”: “224”,
“ITEM_NUMBER”: “0014”
},
{
“SEGMENT1”: “EXTRA_EVENT”,
“DESCRIPTION”: null,
“UNIQUE_ID”: null,
“ITEM_NUMBER”: null
}
]
Regards,
Darshita
05-19-2020 03:26 AM
Hello @Darshita
You can use Group By Fields snap, and group your records by DESCRIPTION field , then downstream Router snap that will route records based on DESCRIPTION field.
Best Regards
Dimche Saveski
06-02-2020 10:02 PM
Is the array streaming document? So I put your array into an object Items
basically the objective is to have an array of description where length is equal to 1 meaning all have the same descriptions. See screenshots below
eval($Items.map((a)=> a[‘DESCRIPTION’]).filter((x,y,z)=> z.indexOf(x) == y).length == 1)