cancel
Showing results for 
Search instead for 
Did you mean: 

How to check condition and route

Darshita
New Contributor II

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

2 REPLIES 2

dimche_saveski
New Contributor III

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

alchemiz
Contributor III

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)

image

image