Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Nested Repeater control in MS word template and populate data from Power platform

(0) ShareShare
ReportReport
Posted on by 14

Hi everyone,

I'm trying to generate a Word document using Power Automate that includes nested repeaters. My data structure includes parent items with multiple child items, and I need to display this in a Word template. Here is an example of my data:

[
{
"Serial Number": "1",
"Title": "1",
"Subtopics": [
{
"KategorieSubtopics": "1",
"TitleSubtopics": "Title 1",
"SerialNumberSubtopics": "Serial 1"
}
]
},
{
"Serial Number": "2",
"Title": "2",
"Subtopics": [
{
"KategorieSubtopics": "2",
"TitleSubtopics": "Title 2",
"SerialNumberSubtopics": "Serial 2"
}
]
}
]

I can display the parent data (Serial Number and Title) in the Word template, but I'm struggling to display the nested child data (KategorieSubtopics, TitleSubtopics, SerialNumberSubtopics). I've tried using nested tables, but the data doesn't seem to populate correctly.

Has anyone successfully implemented nested repeaters in a Word template using Power Automate? Any advice or examples would be greatly appreciated!

Thanks in advance!

  • ppsao Profile Picture
    ppsao 14 on at
    Re: Nested Repeater control in MS word template and populate data from Power platform

    Thanks @AlexEncodian for suggetion.

    I ended up using just one repeating table, creating one JSON array for parent and child both and removing the serial number from the child items so it looks like nested in the word. It worked in my case since I have the similar structure for parent and child data.

  • AlexEncodian Profile Picture
    AlexEncodian 4,302 on at
    Re: Nested Repeater control in MS word template and populate data from Power platform

    @v-mengmli-msft  the data to be populated has a nested structure. You don't need to put the populate word into an apply to each for this.

     

    @ppsao I do not think nested arrays are supported by the native Word connector / populate word action. Someone else might be able to correct me.

     

    Encodian's Populate Word Document action supports this use case and many others. You simply put a repeating sections within a repeating section using the Encodian Template Syntax (does not use content controls - just plain typed text)

     

    The repeating content syntax article has a sub section about nested arrays

    For example:

     

    I corrected the JSON like this:

     

    {"items":
    [
     {
     "SerialNumber": "1",
     "Title": "1",
     "Subtopics": [
     {
     "KategorieSubtopics": "1",
     "TitleSubtopics": "Title 1",
     "SerialNumberSubtopics": "Serial 1"
     }
     ]
     },
     {
     "SerialNumber": "2",
     "Title": "2",
     "Subtopics": [
     {
     "KategorieSubtopics": "2",
     "TitleSubtopics": "Title 2",
     "SerialNumberSubtopics": "Serial 2"
     }
     ]
     }
    ]
    }

     

     

    I set up the template like this:

    AlexEncodian_0-1716829016795.png

     

    And I got this outcome:

    AlexEncodian_1-1716829062264.png

     

    You can control the formatting and spacing in the template. You can see the output just reflects the tabs / line spaces i used in the template.

  • ppsao Profile Picture
    ppsao 14 on at
    Re: Nested Repeater control in MS word template and populate data from Power platform

    Hi @v-mengmli-msft ,

    Sure, here are the screenshots.

    Word template is not inside Apply to each loop. I just have one template stored in document library.

    This is the template with nested repeater - Parent and child. Parent repeater has 1 test box and Child repeater has 2 text boxes.

    ppsao_0-1716803271952.png

    When I populate this template in power automate, Ideally I should get two repeating section with 2 "Add new Item" buttons, one for parent and one for child. But I ma getting only one button. It should allow me to add multiple child items under one parent.

     

    ppsao_1-1716803601368.png

     

    I tried to prepare Array of objects also in the required format and assign that variable in this section, but I am still not able to get data in second repeating section

  • Re: Nested Repeater control in MS word template and populate data from Power platform

    Hi @ppsao ,

     

    The provided expression is to get the second level of data. I am just assuming that the Populate Word Template is inside Apply to each because I don't know your flow. Maybe you can provide some screenshots, it will help us understand the problem and provide the solution.😀

     

     

    Best regards,

    Rimmon

     

  • ppsao Profile Picture
    ppsao 14 on at
    Re: Nested Repeater control in MS word template and populate data from Power platform

    HI @v-mengmli-msft 

    My problem is - the second level of data i not being populated in the output word file, even with the hard coded values. Withe one level of repeater control, I am able to display data.

  • Re: Nested Repeater control in MS word template and populate data from Power platform

    Hi @ppsao ,

     

    If you are using Apply to each to populate value of array to word template, you can try this in KategorieSubtopics field.

    items('Apply_to_each')?['Subtopics/KategorieSubtopics']

    Same logic for TitleSubtopics field and SerialNumberSubtopics field.

     

    Best regards,

    Rimmon

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard