- Goal: I want utils.downloadPage() to run completely before the for-loop iterates to the next index.
- Steps: I've tried using await, but that didn't work since the function is not asynchronous. I've tried putting utils.downloadPage() in an asynchronous function and calling that function with await. I've also tried using a sleep timer both before and after the function. None of these attempts were successful
- Details: I have a container component that is filled with text components. The text components have values in them that change with each iteration in the for loop. The utils.downloadPage() function is the last thing in the loop, but whenever I run it, every downloaded file only contains the text values of the final iteration.
Below is some example code to show what I'm trying to do:
// fruit = {apple, banana, orange}
for (let i = 0; i < fruit.size; i++)
{
// Set the value of Text1 to the current fruit
// Text1 is a text component within container1
Text1.setValue(fruit[i]);
// Download only container1 component
utils.downloadPage(fruit[i], { componentsToInclude: ['container1'] });
}
In the above case, I will only see text1 change to "orange" in the app visualizer and while all filenames reflect the iteration being downloaded (I'll actually get "apple.pdf", "banana.pdf", and "orange.pdf"), the file content will all only contain "orange" rather than each file containing a different element of fruit.
Is there a way to accomplish this?