01-11-2023 01:40 AM
[
{
“items”: [
{
“test”: " ",
“id”: 1
},
{
“test”: “test”,
“id”: 2
}
]
}
]
Currently we have an array like this , we need to route the output from the Router based on the test field , if there is a value the output should go to the upper branch if there is not value for the test field the output should go to the lower branch.
Is there any array method or something else that can be used to achive this ?
01-11-2023 01:54 AM
The simplest way to do the routing is by splitting the array using the JSON Splitter Snap, and then in the Router Snap add the logic where you will route the records based on the “test” field(if it is empty or not).
BR,
Spiro Taleski
01-11-2023 02:29 AM
Thanks Spiro , but for now we need to check the element value inside in the array.
Regards,
Igor
01-11-2023 04:01 AM
If you need to perform routing using the Router Snap(as you mentioned in the post), then you need the data to be flatten.
You can split the data, perform routing and then revert back in array.
Additionally, you can use the Map Function in order to go/iterate trough the array and check elements inside.
BR,
Spiro Taleski