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

Sharepoint list to word - repeatable control element - transpose 3 sharepoint columns to 3 rows in same word table column

hi,

 

I have gotten so far that i can populate my word template with my flow and the sharepoint list.

However i want a dynamically adjusted table in word, with only as many rows as needed.

I need to turn 3 different column values from sharepoint into rows under the same header in word.

 

sharepoint columns:

product1 | product2 | product3 | product1desc | product2desc | product3desc | product1id | product2id | product3id

 

Word table:

Product | Product description | Product ID

 

I tried appending to an array variable but couldnt get that to work.

 

4 REPLIES 4
Highlighted
Super User II
Super User II

Hello @MichChrdk 

Using an array to gather the products is the right way to go. You just need to collect the correct information in the array.

 

You need your array variable, let's name it "Products", variable. You also need an object variable, let's name it "Product".

 

Loop through your list of products and for each item do:

Set "Product" = { "Product" : "<product1>", "Description": "<product1desc>", "Product ID": "<product1id>"}

Append "Product" to "Products"

Set "Product" = { "Product" : "<product2>", "Description": "<product2desc>", "Product ID": "<product2id>"}

Append "Product" to "Products"

Set "Product" = { "Product" : "<product3>", "Description": "<product3desc>", "Product ID": "<product3id>"}

Append "Product" to "Products"

 

The above will collect all your products from each item in the list. If you have empty product columns, add necessary check, so you don't append empty products 🙂

Hope the above helps you on the way.

Kind regards, John

 

Highlighted

Hi @JohnAageAnderse thanks!

 

I will look into that, arrays have always been a thorn in my side never could get my head around them 😄 

 

For the loop i assume an ForEach action, just need to figure out how to put the columns in as a value there, another array?

 

i will most likely end up with empty columns, because the idea is that the number of products will be different from time to time which is a whole other issue. 

 

 

Highlighted

Hello @MichChrdk 

Let me help a little more by adding some screenshots of my test flow 🙂

 

The variables you need in order to collect the product information. The "Product" variable is an object that will hold one product from your list item. The "Products" variable is an array that will hold all the products, each as an object from the "Product" variable.

Flow.MichChrdk.1.Initialize variables.jpg

Your flow then gets the needed products from your list and the next screenshot is the loop (Apply to each) that gathers the 3 products in each of your list items into the "Products" array variable.

Flow.MichChrdk.2.Loop and 3 products collected.jpg

In the above you will have to use your real column names in place of my static test data 🙂

When the loop has finished, you will have the "Products" array variable full of your products. Now you can convert it into an HTML table, as shown.

Flow.MichChrdk.3.Products into HTML table.jpg

And after a test run, it looks like this!

Flow.MichChrdk.4.Products into HTML table result.jpg

Kind regards, John

Highlighted

That is a most supreme helpful response @JohnAageAnderse thank you for taking the time to flesh out a test flow to show, highly appriciated!!

 

While I cant priotize testing it yet, i got some other lists i need to get ready first and this is a "nice to have" thing im looking into for a colleague, i can't wait to get this to work! 🙂 

 

 

 

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 (13,338)