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

Build HTML Table from three separate arrays?

I need to build an HTML table with three separate arrays with each column being one of my arrays. Is this possible? I feel like it but I seem to fail in implementing this. I've tried several different methods but I can't seem to wrap my head around this.

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Dual Super User II
Dual Super User II

Hi @Jdemke 

 

Assuming all the arrays have same number of rows

This can be achieved

 

Arr1, Arr2, Arr3 are names of my 3 arrays which holds the data

 

First initialize a variable of type integer - call it index and initialize it to 0

Also initialize a variable of type array and call it arrFinal and initilizae it to []

 

then run a for loop on arr1 

within for loop

use append to array variable action

select arrFinal and then in Value create json for your columns

 

{

"Column1": item(),

"Column2": variables('arr2')[variables('index')],

"Column 3": variables('arr3')[variables('index')]

}

 

Bold are expressions

 

And then next step in for loop

increment the index variable by 1

 

after the loop completes, you should get a consolidated array of all your columns which you can create an html table from

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

 

 

 

View solution in original post

7 REPLIES 7
RezaDorrani
Dual Super User II
Dual Super User II

Hi @Jdemke 

 

You would have to create a single array which holds all the data together in order to achieve that

 

createArray can be used to generate an array and you can add logic which links all 3 arrays together

But if there is no link then only option would be to create 3 seperate html tables

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

I know how to combine the arrays into a single one but is there a way to keep them in order for the first item in the array is followed by the first item in the second array, etc.. ?

RezaDorrani
Dual Super User II
Dual Super User II

Hi @Jdemke 

 

Assuming all the arrays have same number of rows

This can be achieved

 

Arr1, Arr2, Arr3 are names of my 3 arrays which holds the data

 

First initialize a variable of type integer - call it index and initialize it to 0

Also initialize a variable of type array and call it arrFinal and initilizae it to []

 

then run a for loop on arr1 

within for loop

use append to array variable action

select arrFinal and then in Value create json for your columns

 

{

"Column1": item(),

"Column2": variables('arr2')[variables('index')],

"Column 3": variables('arr3')[variables('index')]

}

 

Bold are expressions

 

And then next step in for loop

increment the index variable by 1

 

after the loop completes, you should get a consolidated array of all your columns which you can create an html table from

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

 

 

 

View solution in original post

Thanks, I got all that but I don't know how to build the expression with the json you posted. I tried it a few ways but it says invalid expression. Am I missing something?

2019_08_05_11_30_23_Edit_your_flow_Microsoft_Flow_Vivaldi.png

 

RezaDorrani
Dual Super User II
Dual Super User II

Hi @Jdemke 

 

In you append to array variable

 

just use

{

"Column1": item(),

"Column2": variables('arr2')[variables('index')],

"Column 3": variables('arr3')[variables('index')]

}

 

 

no need to use json function

Thank you, I appreciate the help!

RezaDorrani
Dual Super User II
Dual Super User II

@Jdemke 

 

You are most welcome !!!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,505)