Check if field inside array has value and route the output

[
{
“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 ?

@Igor_Bozhinovski

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

1 Like

Thanks Spiro , but for now we need to check the element value inside in the array.

Regards,
Igor

@Igor_Bozhinovski

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