HTML Template List Items

I'm trying to work out how to populate a table in my HTML template.

I've added some code based on the sample template which works when I input static values in flow but how do I pass a collection from Powerapps?

I was hoping it was just a case of adding an "Ask in PowerApps" to the template data but that gives an error that it expects a record. I thought about initialising a variable in flow but presumably that would just pass a single value from the collection (table).

It seems like it's possible reading the documentation but I'm stuck. Here's the flow.

Hello @danhfc, thank you for your message.

I’ve tried it myself and it works fine, I’ve used a simple JSON in “Ask in PowerApps” though.
Could you please send me the object that you are trying to pass to “Ask in PowerApps”?
If it contains some sensitive information you can send it to me via PM.

I have some basic text inputs in a PowerApps app along with a collection called ‘PPECollect’, very basic, just 2 columns, ‘Item’ (text) and ‘Qty’ (number value).

I have a submit button in the app which runs a flow that gets the source template and creates the HTML file as per the documentation. This is working fine for the text inputs, the placeholders are replaced no problem.

My question is, how do I go about getting the rows from the collection into the template?

The source HTML has a table with the following code (which may or may not be correct):


I can populate that table using static values in the flow but I obviously only get one row.
For example:


How do I actually get it to work for each item in the collection?

Do I need to initialise variables first, like I’ve had to do for the text fields? Or maybe use the Create HTML Table action?

I’m obviously missing something basic as I can’t find much information on this aside from the HTML syntax.

Any help is appreciated.

Hello @danhfc,

You can specify multiple values so the action could generate multiple rows like that:

This is how the flow looks:

Sure, that makes sense, but what about values in a collection?

Let’s say that “FirstName” & “LastName” came from a list in PowerApps, or a SharePoint list, or any other table, how would you format the Template Data section?

Having a variable for each instance of “FirstName” and “LastName” would require me to know how many rows are in the table before it is run, any number of names/items could be in the list and I need the action to pass each row into the final HTML to create the table.

Hello @danhfc,

In case of using lists, you could use a flow which might look like this:

We are getting all items from a list and then use JSON output from this action in Create HTML from template action.

You source HTML should have this code:

{{#each value}}

And please pay attention to Template Data, I'm using the following function to get JSON data from GetItems action: