l followed this guide to create an HTML template email:
This email is triggered automatically upon adding an item to a SharePoint list. The email includes a table which includes data from the SP list item. The challenge I'm facing now is if it is possible to make the table length change dynamically, since in some cases there are empty rows. Within each item, there may be anywhere from 1-25 rows and this should adjust dynamically. Is it possible to truncate the table length?
Example. Instead of an email like this:
I'd like the flow to dynamically eliminate excess rows to show an email like this:
You say that an email is triggered upon a new item added to your list which likely means you using a Flow. You’ll need to show us details of that Flow because that’s where you’ll need to adjust this
Hi @RodM ,
You could consider using filter+forall to generate dynamic HTML text.
"<table> <tbody> <tr> <th>Column1</th> <th>Column2</th> <th>Column3</th> </tr>"& Concat(ForAll( Filter(TheSPList,!IsBlank(Column1)), "<tr><td>" & Column1 & "<tr><td>" & Column2 & "<tr><td>" & Column3 & "</td></tr>" ),Value) & "</tbody> </table>"
The variable invoked is used to turn a multi-person Person column into a string for emailing.
Would you need to see the HTML code I'm sending for the email
Can you provide a sample data structure so that I can understand this better?
If you are collecting your table data inside the Flow then you can use an Array. What I do is
1. Create a blank Array Variable
2. Then inside an Apply to Each use Append to Array step. This is written in JSON
3. Then, once the Apply to Each is done parse that finished Array to a Create HTML Table step. Flow then builds the table for you
If the data is getting generated in PowerApps then parse to Flow something like what @v-bofeng-msft has suggested will work for you.