Nate Halliwell is on the nifty task of inserting dynamic tables or repeating sections into Word templates using Power Automate. Let's dive into the world of repeating sections and tables!
In our scenario, we're revisiting the asset tracking scenario—quite a common use case. The goal? Send out Word templates to employees, listing their assets along with due dates for each. Monthly or annually, this could serve as a friendly reminder to return the assets on time.
The journey begins with a simple Word document, and to make things dynamic, Nate starts by adding a field for the employee's name. This isn't a repeating section; it's just a single dynamic field. Using the developer tab, a plain text control is added, named 'full name,' ready to be populated later in Power Automate.
Now comes the star of the show—the repeating section. Nate inserts a table into the Word template to capture all the individual employee assets. With three columns for asset type, manufacturer, and due date, the header row is styled to give it that table look.
The next step involves adding input fields for each row in the table. For asset type, manufacturer, and due date, plain text controls are inserted and appropriately named. These will later be mapped to corresponding fields in Power Automate.
The magic happens when our speaker selects all three fields, goes to the developer section, and adds a repeating section. This transforms the table into a repeating section, aptly named 'asset items.' Remember, in the Power Automate world, a repeating section or table is essentially an array.
Now, let's switch gears to Power Automate. Nate has a flow set up, pulling data from SharePoint lists of asset holders and asset managers. The goal is to filter assets for each employee and create an array variable to pass into the Word template.
The first step involves filtering the asset manager table based on the current asset holder. Using logical names and filter queries, the flow ensures that each employee gets a tailored list of assets assigned to them.
To prepare for the dynamic array, Nate initializes a variable named 'V items' at the top level of the flow. Inside a loop, the flow iterates through each asset, appending its details to the array variable. Notably, the array is reset before processing each new employee to avoid cumulative data.
In a notepad, Nate drafts a JSON array structure, keeping in mind the asset type, manufacturer, and due date fields. This array will be dynamically populated with data from Power Automate and fed into the repeating section in the Word template.
With the setup complete, Nate runs a quick test to ensure the syntax is correct and everything is functioning as expected. The flow intelligently retrieves asset details for each employee, creates a dynamic array, and passes it seamlessly into the repeating section of the Word template.
And there you have it! A streamlined process for inserting dynamic tables into Word templates using Power Automate. It's a game-changer for scenarios like asset tracking, making communication with employees about their possessions more efficient. If you're venturing into the realm of dynamic Word templates, this approach is definitely worth exploring.
That's a wrap for today's tutorial! Don't forget to subscribe to the Pragmatic Works' YouTube channel for more practical insights into Power Automate and other tech wonders. And if you want access to even more courses, then sign up for the Pragmatic Works' on-demand learning platform today!