question

KaizheZheng-1489 avatar image
0 Votes"
KaizheZheng-1489 asked BrunoLucas-9843 edited

How can I empty an array variable in Azure Logic Apps?

Hello,

I have create a For Each Loop in Azure Logic Apps. Before, I initialized an array variable and I want to write different infos into it with each iteration. For each new iteration I would like to clear the array variable. For example we have 3 iterations. For the first one I want to get ["red", "blue", "green"], emptying array variable, next ["yellow", "blue", "red"], emptying array variable again and for third ["blue","yellow","orange"].

I have tried to use Set variable in the For each activity with the following values:

array('')
array([])

but each time I get a result like this ["", "yellow" "blue", "red"], ["","blue","yellow","orange"]

Any suggestions how I can clear the array variable without the "" at the start?

Thanks and best regards

azure-logic-apps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

BrunoLucas-9843 avatar image
1 Vote"
BrunoLucas-9843 answered BrunoLucas-9843 edited

Hi, you may not need to do that depending how you arrange the flow, but if you want to try clearing an array, click on the "set value" of "set variable" and switch to "expression", type null and click ok. Another aproach is creating a second array variable, keep it empty and assign the original array to the value of the second array: https://powerusers.microsoft.com/t5/Building-Flows/Clear-array-variable-in-a-flow/m-p/82097#M8153

198131-image001.png



image001.png (21.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.