cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cameron4UCS
Frequent Visitor

Clearing an Array

Hi I have an issue when clearing an array.

I append data to an array but it needs to be cleared every loop. To do this I made an empty array variable and set it as the value of the array. Problem is when I use this, my flow runs forever and never stops. Removing this means the flow completes but then data keeps being appended to the array which I don't want to happen.

 

Any other ways I can clear the array?

7 REPLIES 7
Expiscornovus
Super User
Super User

Hi @Cameron4UCS,

 

Just to double check. Which action did you use to empty the array. Was this the Set variable action and did you use [] as the value to make it empty?

 

setvariable_empty.png

 

If so, can you share a couple of screenshots of the rest of your flow?

Cameron4UCS
Frequent Visitor

Thanks for replying,

 

I have tried using the set variable to set the arrays value to [].

I also made an array variable that was initialized with no value and [], all cause the flow to never end.

I was clearing the array straight after I use it. 

The point of the flow is to add an attachment to a sent email, I tried doing this with SharePoint's get file content from path but I had to hard code it with the array as sometimes get file content wouldn't get the files (so the array value is very long). The array needs to emptied or else they receive multiple email attachments.

 

 

Cameron4UCS_1-1632344041297.png

 

Cameron4UCS_0-1632344014791.png

Cameron4UCS_2-1632344074769.png

Cameron4UCS_3-1632344100029.png

I managed to set the variable to clear it instead of appending it then clearing it later on.

It is working now thanks for the help.

I have just tried again and it has stopped working. 

Trying to set or clear the array results in the flow continuously running, but appending to the array works fine.

Unless the length of the string I am passing into the array is the issue otherwise I am not sure.

Expiscornovus
Super User
Super User

Hi @Cameron4UCS,

 

Strange issue. Can you share a screenshot of the whole setup of your flow? 

 

Let me rebuild it in my development environment and see if I can reproduce your behaviour. After that I can try and find a solution for it.

Thanks for your help.

I managed to solve it by using the file get content from path dynamic content as the value for $content inside the array. It let me set the array without issue after that.

Expiscornovus
Super User
Super User

Hi @Cameron4UCS,

 

Great to that you manage to solve it. Saves me some time building for a reproducing the issue 😁

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,533)