cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kamil
Level: Powered On

Clear array variable in a flow

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? 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Clear array variable in a flow

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:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> "Initialize variable" action, Name set to GlobeArray, Typre set to Array and Value set to empty.
  • Add a "Get items" action, specify Site Address and List Name.
  • Add a "Apply to each" aciton, input parameter set to output of the "Get items" action. Within "Apply to each", add a "Append to array variable" action, Name choose GlobeArray, Value set to Due Time dynamic content of the "Get items" action.
  • Under "Apply to each" action, add a "Compose" action, Inputs set to GlobeArray variable.
  • Add a Variables-> "Initialize variable 2" action, Name set to EmptyArray, Type set to Array and Value set to empty.
  • Add a "Set variable" action, Name choose GlobeArray variable, Value set to EmptyArray variable.

Image reference:4.JPG

 

5.JPG

The flow works successfully as below:6.JPG

The value of GlobeArray variable after first iteration of loop as below:7.JPG

The value of GlobeArray variable after clearing array as below:8.JPG

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Clear array variable in a flow

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:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> "Initialize variable" action, Name set to GlobeArray, Typre set to Array and Value set to empty.
  • Add a "Get items" action, specify Site Address and List Name.
  • Add a "Apply to each" aciton, input parameter set to output of the "Get items" action. Within "Apply to each", add a "Append to array variable" action, Name choose GlobeArray, Value set to Due Time dynamic content of the "Get items" action.
  • Under "Apply to each" action, add a "Compose" action, Inputs set to GlobeArray variable.
  • Add a Variables-> "Initialize variable 2" action, Name set to EmptyArray, Type set to Array and Value set to empty.
  • Add a "Set variable" action, Name choose GlobeArray variable, Value set to EmptyArray variable.

Image reference:4.JPG

 

5.JPG

The flow works successfully as below:6.JPG

The value of GlobeArray variable after first iteration of loop as below:7.JPG

The value of GlobeArray variable after clearing array as below:8.JPG

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Kamil
Level: Powered On

Re: Clear array variable in a flow

Thanks for help.

sh1
Level: Powered On

Re: Clear array variable in a flow

You can also do a Set Variable with a value of null.

Matt_Markahm
Level: Powered On

Re: Clear array variable in a flow

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?

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,972)