I just wanted to post about an extra purpose for the new Arrays actions which has proved invaluable for me.
I had a query which was returning data. However, I needed to make it slightly more complicated where one of the values needed to be different based on a condition from another field. But I didn’t want to recode everything so I used Arrays to adjust the JSON which is output.
- I initially used the Create Array List and set the schema to match my query.
- Then I did a repeat to cycle through my existing query results and added what conditions I needed
- Then an Add In Array List action allowed me to fill the fields with the data I wanted
- Finally, a Get Array List Value provided the result
But, the trick was to switch off Output from my original query and then set the name of my final Get to match that query, eg. queryMyOutput
This meant my SC output was identical to how it was before but now with the manipulated data. No editing on the client side at all, I just send back the updated data.
And if you want to do the same with a single record, just use the Get Array List Index instead.
Brilliant! Thanks again to the Wappler team for creating these gems which make building these solutions so much fun and pretty easy.