Hi All, I had posted this question before but my post seems to have been removed.
I am struggling with what I think is a very simple task which I am not able to find the right method to achieve.
I have an array built from a sharepoint list which includes project manager names and project numbers. I am trying to reduce the size of the html table at the end of the flow by combining the output of same name PMs into one line.
I have used select and 'union' to reduce the duplicates in the array as well. Here's an example of what I am trying to do:
Original Table
PM #
David 12345
David 6789
Mike 111
Mike 222
Zack 000
Desired Output (Transposed?)
PM #
David 12345, 6789
Mike 111, 222
Zack 000
I've spent a lot of time on this and can't see the solution, but I admit I am a relatively basic Power Automate user.
Can anyone help?
Wow, @ManishSolanki thank you so much for putting the time into that. I will try this out on Monday and get back to you!
Thank you again
Hi @wee_georgie
Here is the sample flow which will help you getting the desired html table from an array.
I have stored the input array in a compose action:
Next, initialize an array variable 'OutputArray' that holds the output:
Add "Select" action to create an array of PMs:
Expression used in the above screenshot. Expression needs to be entered in the expression box as highlighted in the above screenshot:
item()?['PM']
Next, add "Apply to each" action to get unique PMs & we will write an expression using union function to achieve this:
union(body('Select'),body('Select'))
Continue in Apply to each action block, add "Filter array" action that will search for PM record in original array using query. This action will return the record(s) for unique PM in each iteration:
To add filter query, click "Edit in advanced mode" button on the bottom of filter array action and enter the query in the box:
@equals(item()?['PM'], items('Apply_to_each')?['PM'])
Add another "Select" action to create an array of column '#' for each PM. Pass the output of filter array action as input to select action. Click on "Switch Map to text mode" bottom on the right side & write an expression in the Map box:
item()?['#']
Add "Append to array variable" action in the apply to each action block:
{
"PM":@{items('Apply_to_each')?['PM']},
"#":@{join(body('Select_2'),', ')}
}
Finally, add Create HTML table action to get the desired table. Pls note that this action should be added outside of apply to each action block:
The output obtained after executing the flow:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
Thanks
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1