Hello,
I’m having issues using the data from a nested array in a flow. My main issue is the array called “selectedOptions”. I just need the value of it but I’ve tried everything and it’s been an incredible waste of time. Does anyone have suggestions on how best to get this data to go through the flow. Literally every single other piece of data goes through except this part, that it’s what I actually need.
Hi @em_ghost you can accomplish this don’t give up!
To access nested data in Make it is best to use combinations of map() flatten().
Your IML function would look like this:
flatten(map(flatten(map(Items;selectedOptions));value))
remember not to type out Items; instead, map the array from your output here.
That’s returning an array with the data but I can’t use the data later in the flow.
I was able to get the variables using this formula:
{{get(map(24.items.selectedOptions; “value”; “name”; “Select target language”); 1)}}
But the main issue is that it’s not working with the iterator. I need to add a new row for every product the customer has, and that row must have specific options for that product. The issue I think it the path key that is only returning data for the first product in the collection. How can I make that path broad to include all of the items in the collection?
I’m uploading the JSON output bundle and an image of how I have this set up currently.
bundle.json (19.1 KB)
The order comes through the API and I need to add a row at main order table, and then the item that the user ordered in a line items table. What I need is to have the selectedOptions array populate for each item so that I can add the options the user selected into the line items table. So far the closes I’ve gotten is using this formula in the text:
The issue with this one is that I need it to populate for every line item the user added, that is my main issue.
The Flatten formula gave me everything in an array but I can’t use that data in the order. Does anyone have any suggestions? The amount of time I’ve spent on this is insane.
Hey @em_ghost I tried importing the blueprint you posted but it says it’s invalid. It’s a little difficult to understand the full problem, could you try exporting your scenario again.
-Harman at harman@ioadigital.com
Okay the scenario looks good to me, when you iterate the Items array and create a row for each, shouldn’t you be able to map everything you need? If you could share some screenshots of the output data that would also help.
Note on your HTTP module, change these settings:
You won’t need to use the Parse JSON module this way
I got it to work, thank you! The only issue I have now is getting the file url which is in a nested url inside selected options array. I’ve tried altering the map formula but nothing.
I just need that URL to go through into the spreadsheet. Any tips?
gotcha, yeah you can use a similar process here.
First we need to map to the selection options again.
get ( map ( flatten ( map ( flatten ( map ( Items ; selectedOptions ) ) ; files ; type ; FILES) ) ) ; url ) ; x )
Replace x with the url you want, 1 for first url, 2 for second, and so on.
I highly recommend downloading the output from this screenshot, and copy pasting it into a “Parse JSON” module, then add a set multiple variables module after it.
Then use all the different parts of the above IML function.