web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Select Action output t...
Power Automate
Answered

Select Action output to a "Append to array variable" action is causing the flow to error out

(0) ShareShare
ReportReport
Posted on by 282
Flow structure:
rkirk2k_0-1687197326801.png

 

My trigger gets a text string called "searchTerm" from my power app.

rkirk2k_1-1687197387490.png

 

I'm initializing an array variable called "varSearch" (that will be sent back to the app once fully appended).
rkirk2k_2-1687197423477.png

I'm using a "Get items" action and pulling in all items from my SharePoint list. (No advanced settings)

Next I have an "Filter array" with a condition statement that is returning only items where "searchTerm" is contained in any of the three columns (Title, Description, ActionsTaken).

rkirk2k_3-1687197499317.png

 

The condition statement that has been working correctly is...

 

 

(
	contains(item()?['Title'], triggerBody()['text']),
	contains(item()?['Description'], triggerBody()['text']),
	contains(item()?['ActionsTaken'], triggerBody()['text'])
)

 

 

 

In an "Apply to each" action, I want to use a "Select" action to grab only the columns I need and append each item processed to my array variable.
The "Apply to each" action configured this way...
rkirk2k_5-1687197686011.png

 

I'm running into a problem around the work I'm trying to do inside my "Apply to each" action.
 
I WANT to only work with nine columns, and for the four complex columns to only return...
  • 2 X Choice columns (TaskStatus & Priority) - only the selected values
  • 2 X Person columns (Customer & AssignedTO) - only "DisplayName"
My "Select" action is set to handle grabbing just those columns, and it works correctly (outputs look good upon inspection after a successful run).
rkirk2k_6-1687197745396.png

 

The issue I'm running into is with the "Append to array variable" action...

 
PROBLEM DESCRIPTION: 
When I use the "Output" of my "Select" action as the input for "Append to array variable" action...
rkirk2k_9-1687198612697.png

...the flow errors out at "Append to array variable" with the following...

rkirk2k_7-1687198355501.png

 

NOTE:
If I use "Current item" from the "Apply to each" action as the input for "Append to array variable" action...
rkirk2k_10-1687198733968.png

...the entire flow runs successfully.

But since this BYPASSES the "Select" action, the output contains ALL columns for each SP item, as well as all meta data associated with the complex columns (ie. Claims, Picture, etc... for persons)... Not what I need.

rkirk2k_8-1687198513231.png

 

Any assistance with how I can use the output of "Select" but avoid the error in the "Append to array variable" is greatly appreciated.
 
End goal:
After "Apply to each" runs, my "varSearch" variable should have the filtered results, and "Respond to a PowerApp", returning the resulting array to my PowerApp...
rkirk2k_0-1687199282670.png

My app receives the response from the flow, and uses "ParseJSON" to create a table, and pass the data into a collection that I display in a gallery.

Categories:
I have the same question (0)
  • Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Hello @rkirk2k ,

     

    you can’t append an array to an array. Use union instead. After a conpose using union you can use set variable to get the new array into your variable.

  • rkirk2k Profile Picture
    282 on at

    Would you happen to have any further instructions on this? Any docs I might reference?

  • Verified answer
    Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Here is a link: https://zeitgeistcode.com/power-automate-union-function/

     

    but you can of course always take a look at the official documentation from microsoft.

     

    Instead of append to array use a compose action with an expression like “union(YOURVARIABLE, SELECTOUTPUT)”. After that you can use “set variable” to set your variable with the output from the compose action.

  • Verified answer
    rkirk2k Profile Picture
    282 on at

    So, thanks to @Matthy79 for putting me onto the right path, I found the solution.

    Here is the structure of my "Apply to each" action...

    rkirk2k_0-1687265346847.png

    Added a compose action that I renamed to "Union". For "Inputs" I used the expression...

    union(variables('varSearch'),body('Select'))
    Used "Set variable" with the output from "Union" to update my varSearch variable.
     
    Then after the "Apply to each" action, I added a "Compose" action to capture "varSearch" so its output can be used by my "Respond to a PowerApp or flow" action to send back to my app.
    rkirk2k_1-1687265788861.png

    It works beautifully. Now I'm no longer constrained by the 2000 item limit due to delegation issues with search and SharePoint!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard