cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

HELP! How do I convert an array into a one-column HTML Table?

I have an array variable that stores contents as follows:

 

[
"A",
"B",
"C",
"D"
]

 

How do I convert this into a usable HTML table with a column header of "Item"? The result would look like the following:

Item
A
B
C
D

 

14 REPLIES 14
Highlighted
Super User III
Super User III

hi @pwrappr01  what you need to do that is convert the array in a valid format for example you need an array like this:

 

values.PNG

 

to get this result

 

pasrt2.PNG



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Highlighted

How do I go about converting the array provided so that there are headers at the start? The array I listed is the result of an apply to each that loops over a SharePoint list, so I can’t figure out how to get the headers in place.
Highlighted

@pwrappr01you need to convert you array output into string like this string('HERE YOUR OUTPUT') then you can format every part of your array if is static you can use the next expresions in a separeted compose actions.

To letter A

 

 

concat(replace(split(outputs('ToString'),'","')[0],'[','{"values": '),'"}')

 

 

Letter B

 

 

concat('{"values": "',split(outputs('ToString'),'","')[1],'"}')

 

 

To letter C

 

 

concat('{"values": "',split(outputs('ToString'),'","')[2],'"}')

 

 

To letter D

 

 

concat('{"values": "',replace(split(outputs('ToString'),'","')[3],']','}'))

 

 

Then just add all the composes into you table action following the example a give you.



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Highlighted
Super User III
Super User III

Hi @pwrappr01 

 

If your array length is fixed you could do the following way.

 

image.png

 

Above the header expression is as follows:

variables('test')[0]
variables('test')[1]
variables('test')[2]
variables('test')[3]
 
Test Result:
image.png


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Community Support
Community Support

Hi @pwrappr01,

 

Just like @ChristianAbata 's advice, before creating an HTML table, you should create convert the array convert into JSON, and I have a simple method could help you:

  1. Put the array into an array variable.
  2. Initialize an array variable named JSONArray.
  3. Create Apply to each action, then Append to array variable to put the A, B, C, D into the JSON.
  4. Create HTML table.

Annotation 2020-02-26 123465.png

 

Annotation 2020-02-26 123466.png

 Run result:

Annotation 2020-02-26 123467.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted

@v-litu-msft, this is definitely the solution. Any chance you have a recommendation for how I could then drop that into a Teams message using the Post Message as Flow bot to user action? I got a message, but it shows like this:

 

Value A B C
 
Is there any way to force this to show as rows in Teams?
 
 
Highlighted

Hi @pwrappr01,

 

Sure, you could use this action:

Annotation 2020-02-27 164257.png

 The message in the MS teams:

Annotation 2020-02-27 164258.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted

@v-litu-msft That's what I thought. This is what I am now getting, however:

<table><thead><tr><th>Value</th></tr></thead><tbody><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>C</td></tbody></table>
 
I wonder why?
 
My action step has the output of the HTML table that used the JSONArray we built.
Highlighted

Hi @pwrappr01 ,

 

Sorry for late, <table><thead><tr><th>Value</th></tr></thead><tbody><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>C</td></tbody></table> is the code of the HTML table? How do you get this format text? you could share screenshot of the run result.

And If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

Best Regards,
Community Support Team _ Lin Tu

Highlighted

@v-litu-msft The values I am pulling are being created from an "Apply to each" loop for a SharePoint list:

 

ApplytoEach for List.png

 

Then, I do the steps we discussed regarding appending to an array, converting to table, and posting in Teams:

 

Output to Teams.png

 

This is the result in Teams:

 

Teams Result.png

 

 

Highlighted

Hi @pwrappr01 

 

Not sure this is possible. Please see this link

 

https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Ability-to-use-HTML-for-MS-Teams-Flow-bot-p...

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted

Hi @pwrappr01,

 

The HTML could support on post a message as Flow bot to a channel, but not supported on the post a message as Flow bot to a user action.

You could go to the Idea provided by @abm, vote it to make it come true.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted

@v-litu-msft @abm ah, sad day. Well, I appreciate your help along the way. Glad to know I wasn't going crazy.

Highlighted

hi @pwrappr01  I'm glad you solved your dude.

 

Please consider to mark an answer like solved to guide other users. 😉



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (12,068)