web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Populate a word templa...
Power Automate
Answered

Populate a word template with a repeating row in a for each loop strange behaviour

(0) ShareShare
ReportReport
Posted on by

Hi,

I am working on a flow with the following steps.

I query dataverse on all accounts that have unpaid invoices.

Then for each account of my query the flow get a list of invoices; after that I fill an array variable for each invoice with the information that I want to display in the word document.

In the next step I populate the word document with all the relevant information. The matrix variable goes in the repeating row of the template.

When I run the flow it functions as expected (a word file for each account) except that the repeating row shows a strange behaviour.

The first document that is generated shows the expected number of rows. The second document that is generated shows all the rows of the previous document plus the rows that are in the related array variable. This goes on until the last document is generatied that has then a list of all the unpaid invoices of all the accounts that were in my selection.

It appears as if the word action is not emptying the repeating row but keeps the already used information and adds new information to that section. 

Doe anyone know how to avoid this - something like resetting the word action before creating the next document?

 

 

Categories:
I have the same question (0)
  • Rilsina Pegado Profile Picture
    on at

    Hi,

     

    I had a similar issue, when the first row kept repeating in the table, I removed the content controls on the template and added the same again( first content controls than repeating controls) and it was resolved after that.

     

    Also, in your case, check the value that array has to make sure the input to word template is correct, if needed you can set the array variable as null at the end of the flow run.

    https://www.cloudfronts.com/populate-repeating-control-of-word-template-using-power-automate/

     

     

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

  • Verified answer
    dverhetsel Profile Picture
    on at

    The solution is the second thing that Rilsana says. The problem is not the word action but sits in the 'add to array' action. In a for each loop this action adds to the array each time (even when you don't see this in the content). So you need to set the array variable to null at the beginning or end of the for each loop.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard