Second lambda in loop

Is it possible to add a second lambda to a loop within a retool workflow? In my workflow I am looking to:

  • query retool db and for each row:
    • run an insert query on another resource
    • update the retool db for that row to mark the row as imported to my external resource

it doesn't seem possible to do both right now, I can either run the insert on my external resource, or update the retool DB - but not both.

if you set your loop to Code mode inside the loop you can call var ret = await query1.trigger({additionalSource:{myvar: 'my value'}}).

:exploding_head: here I am coding up multiple loops in JS blocks while @bobthebear is over here making workflows dance...

well, lets pretend I didn't originally try and link the output of a block to a previous block to try and 'recursively' call/use a Loop Block :laughing:. Honestly though, depending on what you're nesting here and how deep the nesting goes (ie loops inside loops inside loops....) you could run into a memory problem (either a hardcoded retool one or one from your browser/platform) . in this case using more than 1 loop block might be a better option as memory can be freed after each block lowering overall memory used over the runtime length

2 Likes