cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewBee117
Advocate V
Advocate V

Get the data array out of "Apply to Each"

I initialize the variable ApplytoeachOutput to an array, then set it to the array from the selection in the "Apply to each" loop, all looks fine in the loop. However, when I call the ApplytoeachOutput outside the loop, it has the same amount of items, yet the value is repeating the last row. Any idea what is the proper way to get the selected data out of the "Apply to each" loop?

    

   NewBee117_0-1620401272127.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
zaphod88
Responsive Resident
Responsive Resident

You have to replace your "Set variable" action by "Append to array". If you want to, you can also get rid of the SelectItem action and replace it by the following formula in "Append to array":

{ 
"ID": @item()?['ID'],
"Title": @item()?['Title']
}

 and so on, just insert your own need columns. The "@"-mark means it has to be insertes by expression editor.

View solution in original post

1 REPLY 1
zaphod88
Responsive Resident
Responsive Resident

You have to replace your "Set variable" action by "Append to array". If you want to, you can also get rid of the SelectItem action and replace it by the following formula in "Append to array":

{ 
"ID": @item()?['ID'],
"Title": @item()?['Title']
}

 and so on, just insert your own need columns. The "@"-mark means it has to be insertes by expression editor.

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,314)