Goal: Display API results in a mobile app listcollection. For each row returned, use one of the values in another API call and return a value from that second API call along with some data from the first API
Steps:
Query API#1 (GET qGetInspectionsDue) for a list of inspections due (demo is limited three, live feed could have up to 50)
Take the name value returned by API#2 and display in the listcollection as well.
I've played with the magic i, tried setting a variable for each row loaded and passing that to API#2, Tried (and failed) to dig into additional scopes and using map.
Nearest I've got to is the image below but can't get my head around how I pass a usable variable into to the API path itself and get it to loop through each
Also tried using a transformer in API#1 to call API#2, had a chat with the AI that indicated that using the map command would be the way forward, then trigger API#2, but again, stuck how I pass the ID into the API.
Hello there Charles, welcome to the forum!
I've had a similar issue with setting variables and looping them within a Retool Query resource to no avail. Also, when having to subsequently hit 2 different API endpoints, the event handling in Retool seems to not respect the order in which the events are configured inside a component.
What I found to be the best solution, although it may not be as pretty, is to perform all fetch functions inside a JavaScript code snippet.
Keep in mind: Triggering Retool resources within the same JS code did not work for me, and I had to fetch manually to every API endpoint using native JS.
If you have any questions, please let me know. Hope this helps!
Keep in mind that, while workflows are great, they do come with some inherent limitations. Of particular note - organizations on at least a Team plan are allocated a total of 5000 workflow runs every month, with each additional 5000 runs costing $75.
Depending on the number of active users, it's possible to hit that initial limit fairly quickly. You can easily track the number of runs you've used, though.