Ah so you're essentially trying to pass the i
variable into two queries, but you'd only like to run the second query on success of the first query.
Great question!
There are a few ways to do this, but I'd probably do something like this:
1. Button's event handler runs a script to trigger both queries. It triggers query1 first then on success, triggers query2. In query2, it passes in the i
variable as additionalScope. Here's a community post walking through additionalScope and here's the code I used:
query1.trigger({onSuccess:() => query2.trigger({additionalScope: {i_var: i} })})
2. query1 stays the same, but query2 now needs to reference i_var
(this is a random name I gave our additionalScope variable in the event handler. You can name it whatever you'd like!) instead of just i
like so:
Let me know if you have any questions about this!