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

Kaizhe Zheng 186 Reputation points


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:


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
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,112 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruno Lucas 4,216 Reputation points MVP

    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:


    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful