I have a working flow with for each loop. In loop i'm using array variable to build a list of item to send it in e-mail. In next loop i need to use the same variable, but I want to start adding to empty array. How to set array variable to be "blank new" for next iteration of loop?
Solved! Go to Solution.
Hi @Kamil,
Could you please share a screenshot of your flow's configuration?
Do you want to set the array variable to empty for next iteration of loop?
I think a empty array variable could achieve your needs, I have made a test on my side and please take a try with the following workaround:
Image reference:
The flow works successfully as below:
The value of GlobeArray variable after first iteration of loop as below:
The value of GlobeArray variable after clearing array as below:
Best regards,
Kris
Hi @Kamil,
Could you please share a screenshot of your flow's configuration?
Do you want to set the array variable to empty for next iteration of loop?
I think a empty array variable could achieve your needs, I have made a test on my side and please take a try with the following workaround:
Image reference:
The flow works successfully as below:
The value of GlobeArray variable after first iteration of loop as below:
The value of GlobeArray variable after clearing array as below:
Best regards,
Kris
Thanks for help.
You can also do a Set Variable with a value of null.
I have used the approach of setting the variable equal to null, however it stopped working about a week ago. Has the syntax of the "null" function changed?
Hi
You can just set variable to "[ ]" this will empty you
Thanks and Regards
Vivek Verma
I'm not sure if the solution provided answer the user's question ... perhaps it did. But that shows how to reset an array after a loop as completed, as opposed to resetting for each iteration of the loop ... a scenario I think probably more common. Like if you were looping thru a list of managers and e-mailing that manager an array processed within the loop ... you'd want that array reset each time so one manager didn't get a cumulative listing of all preceding manager's info.
In this case, you still use the "Set variable" and set the variable's value to "[]" (empty array) WITHIN the lop ... however, you also have to set the loop's Concurrency Control. You need to turn it on and set the degree of parallelism to 1 ... this ensures the array is access by multiple parallel operations of the loop. You get to the settings by click the "..." and selecting "Settings" on the "Apply to each" control
You don't know how much that answer helped me! Thanks so much. This is such a common scenario as you'd want to reuse an array.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
72 | |
27 | |
22 | |
15 | |
13 |
User | Count |
---|---|
141 | |
42 | |
42 | |
34 | |
30 |