I'm trying to join multiple arrays into one array. I have a flow that queries in loop all Planners plans, for each plan gets a list of tasks. I would like to join lists of tasks from each plan into one big list. When I try to add an array to an array using the "Append to array" action I get the following error: "The value 'VALUE OF ARRAY' of type 'Array' cannot be appended to the variable 'List' of type 'Array'. The action type 'AppendToArrayVariable' only supports values of types 'Float, Integer, String, Boolean, Object'." Is there any way to transform the Array to a type that is supported by Append To Array action? Or maybe there is some other action that can merge two arrays?
Hi @PW365Club ,
Can you post a screenshot of the expanded flow to better assist you with this? Please have a look at the screenshot below: I am listing all my plans and based on the plan ID, listing the tasks and populating the array with those values in an iterative mode and finally I have a huge single list of tasks.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi! My flow was almost identical to yours, but I was inputing "value" into the "Value" field. When I use the "body" as input for the activity I do not get errors, but unfortunatelly activity does not concatanate arrays. What it does it creates one row in array for each list of tasks for plan. In each row there are 3 columns - odata.context, odata.datacount and value. The value column contains entire list of tasks for a plan in Odata form.
What I want to have is an array that has separate row for each task, and colums that describe the task - plan, owner, due date, etc.
Looks like the "Add to array" activity does not accept adding arrays - you can only add a single row. I made a workaround that inside the loop for plans I have added second loop for each task and inside this loop I add each task separately. Not really elegant solution and more time consuming - instead of just grabing the list I have and just appending it I need to cut it in pieces and feed pieces to activity. I am also thinking about just trimming the opening and closing square brackets and concatenate the lists of tasks as a string and then turn it to array after concatenating.
You can obtain the desired result with 2 actions and no loop:
1) a compose action with this formula: union(variables('plans'),body('List tasks'))
2) a 'set variable' action to update the variable 'plans' with the output of the compose action
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Read the latest about new experiences and capabilities in the Power Automate product blog.
If you are a small business ISV/Reseller, share your thoughts with our research team.
The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.