I implemented a loop as is explained in Scripting Retool and it worked perfectly.
But now i need to stop the loop based on a condition.
How can I do that?
This is my loop.
var rows = get_next_page_from_header.value;
function runQuery(i) {
find_temporary_items_batch.trigger({
additionalScope: { i: i }, // This is where we override the `i` variable
// You can use the argument to get the data with the onSuccess function
onSuccess: function (data) {
runQuery(i + 1);
},
});
}
runQuery(0);