Nested iterators

Hi I need to have nested iterators, this is my structure that I have

[
{
“key”: “”,
“values”: [A, B, C..]
},
{
“key”: “A”,
“values”: [1, 2, 3]
},
{
“key”: “B”,
“values”: [4, 5]
},
{
“key”: “C”,
“values”: [7, 8,9,10]
}
]
I want to iterate the array in the EMPTY KEY, once each iteration I want to iterate their values

I think you can use

{{ get(filter(yourarray; item; item.key = ""); 1).values }}

to get the key=“” values than use a iterator with:

{{ get(filter(yourarray; item; item.key = map_value); 1).values }}

and “map_value” will contain the current value when iterating through the values.

question, I do not see a FILTER function. Do you have it?

not tested but try this:

{{get(first(map(yourarray; if(get(item; "key") = ""; get(item; "values"; emptyarray); emptyarray))); 0)}}

Iterator:

{{get(first(map(yourarray; if(get(item; "key") = {2.value}; get(item; "values"; emptyarray); emptyarray))); 0)}}

@Ivy_Saskia

The structure you have is not an array. You can just add a filter and map values array in iterator. filter “key does not exist”

Regards,
@Msquare Automation - Platinum Partner of Make

1 Like