Hey guys, I created a map function that isn’t working, could anyone tell me what I did wrong?
Context:
I need to extract the checklist item’s ID from the Checklists array. The criteria/filter is if the checklist item name is “Info form sent” which you can see in the screenshot.
This is the map function I used
{{get(map(5.checklists; "idChecklist"; "checkitems.name"; "Info Form Sent"); 1)}}
I used another map function to extract checklist id based on name and that worked, but this one is an array inside an array and I have never used a map function for that.
Yeah this won’t work as an array reference
checkitems.name
Map() works on arrays or collections and returns an array and get() works on arrays only. Map() cannot take an array as an input.
Use the array you want to map in the first argument but make sure you click the checklist items
array into map() as first argument.
But I think you may need iterate the top level checklist
array first and then use a filter to pass only bundles that fit your criteria. Then you’ll get each element of the checklist array you can inspect with a filter and then pass into a set variable exactly what you want. Sometimes this is easier than doing a complicated map().
1 Like
There is another post where I show how to reference the proper JSON path on a nested collection like this. If you haven’t solved this yet have a look there. I also made a video on how to find the proper dot notation to access a nested part of a collection using the object dot notation.
1 Like