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

Converting array to html table - troubleshooting

I am trying to set up a flow that informs a set of people what the latest updates to a SharePoint document library are. It draws the items that were new in the last 7 days and provides certain data from the associated columns in a table which is input into an email and sent out every Monday.

 

Unfortunately, one of the columns is a multi-select choice column, which means the table contents are messy. I have therefore tried to build an array including only the choice items and removing all the ID etc. information that comes along with it. I have so far managed to create an array with the data I am looking for but am struggling to then convert that into an html table to go in the email.

 

I have Googled until I am blue in the face and tried some of the suggestions but I am still getting errors in the html table conversion, so looking for some help to troubleshoot it. I am a relative novice, my programming knowledge is based on past VBA experience so it explain it like I'm a beginner ;).

 

The flow steps look like this:

bug289_0-1633705609714.png

 

bug289_1-1633705632387.png

 

bug289_2-1633705671325.png

 

bug289_3-1633705682783.png

 

The output results at each stage look something like this:

bug289_4-1633705778654.png

 

bug289_5-1633705807555.png

 

bug289_6-1633705825871.png

 

The info to parse JSON etc I got from this link: https://powerusers.microsoft.com/t5/General-Power-Automate/Create-HTML-Table-from-Array-of-Strings/t...  As you can see, there is some issue with the 'split' formula that means I'm getting extra ': ' that I need to work through but the main issue is that it is still not seeing it as key value pairs and the error I get when creating the html table is:

bug289_7-1633706138274.png

 

I have tried creating the columns manually in the html table but that also didn't work.

 

Anyone have any thoughts or recommendations?

1 ACCEPTED SOLUTION

Accepted Solutions
Mira_Ghaly
Dual Super User II
Dual Super User II

@bug289 

I have replicated the same scenario at my side so i have a column called Title and a choice column Called ChoiceColumn , So please follow below steps to achieve what is required

Mira_Ghaly_0-1633764208761.png

 

Mira_Ghaly_1-1633764499570.png

1: Concatenate Expression

concat(variables('ChoiceString'),',',items('Apply_to_each_2')?['Value'])

2: Remove first , Expression

substring(variables('ChoiceString'),1,sub(length(variables('ChoiceString')),1))

Mira_Ghaly_2-1633764732275.png

Then you just pass your TableArray to create HTML

Mira_Ghaly_3-1633764812263.png

 

And here looks the output of the HTML Table looks like:

Mira_Ghaly_4-1633764915660.png

 

 

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

View solution in original post

1 REPLY 1
Mira_Ghaly
Dual Super User II
Dual Super User II

@bug289 

I have replicated the same scenario at my side so i have a column called Title and a choice column Called ChoiceColumn , So please follow below steps to achieve what is required

Mira_Ghaly_0-1633764208761.png

 

Mira_Ghaly_1-1633764499570.png

1: Concatenate Expression

concat(variables('ChoiceString'),',',items('Apply_to_each_2')?['Value'])

2: Remove first , Expression

substring(variables('ChoiceString'),1,sub(length(variables('ChoiceString')),1))

Mira_Ghaly_2-1633764732275.png

Then you just pass your TableArray to create HTML

Mira_Ghaly_3-1633764812263.png

 

And here looks the output of the HTML Table looks like:

Mira_Ghaly_4-1633764915660.png

 

 

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,628)