In my app, I have created a temporary state. Let's call is state1.
In my first JS query, I run a loop and set this state's value to the first value from an array.
once this value is set, I trigger another query which is a resource query.
It hits a certain API which has the following structure.
Now, in the loop, it is not updating the value of the state.
The loop is supposed to run till the length of the array I mentioned.
IN every iteration, it is supposed to update the value of state and run the resource query with the value of that state updated.
But instead the loop runs to the length of the array but the state isn't updated in every iteration. It takes the last value from the array even though I am assigning it based on the index of the loop.
var testArray = ["a","b","c","d"];
for(i=0; i < testArray.length; i++){ // removed the <= this was the reason for seeing only last value
//state1.setValue(testArray[i])
query97.trigger({ additionalScope: { variableName: testArray[i] } });
query94.trigger({ additionalScope: { variableName: testArray[i] } });
console.log(testArray[i] + ' ' + i);
}
You then add {{variableName}} to each of the queries...