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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use Concat on Collecti...
Power Apps
Answered

Use Concat on Collection for HTML output only when Collection row is not empty

(0) ShareShare
ReportReport
Posted on by 5

I have a Collection named colShoppingCart. I am sending an HTML email to the customer upon checkout that includes all the items in the shopping cart that they ordered.

 

I am using Concat in the HTML to populate a table that is sent to the user.

 

Concat is iterating through the Collection and populating the HTML table just fine and the results in the email are great...except that the last iteration creates an empty row in the HTML table.

 

 

<th>Product Name</th> <th> Quantity Ordered</th>
<tr>" & Concat(
 colShoppingCart,
 "
 <td style='text-align:center'>" & Description & "</td>
 <td style='text-align:center'>" & QTY & "</td><tr>
 )
)

 

I know what the issue is, I just don't know how to fix it. The second <tr> tag does its job and creates a new line in the HTML table after each Description and QTY is printed, but since its putting a new row after each row created, it creates an empty row just before it exits the Concat function.

 

What I am trying to do is stop creating the empty row in the HTML table.

 

Any help would be appreciated.

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,315 Most Valuable Professional on at

    Hi @DanAugust ,

    Try </tr> instead of <tr> on the last item

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • jesse_sql Profile Picture
    30 on at

    Hi! Is it possible that the function returns a text-value that ends with a pattern that you could recognize and replace so it removes the last opening tr-tag? For example 

    Substitute("
    <table>
    <th>Product Name</th> <th> Quantity Ordered</th>
    <tr>
     <td style='text-align:center'> description_1</td>
     <td style='text-align:center'>" qty_1 </td> 
    </tr>
    <tr>
     <td style='text-align:center'> description_2</td>
     <td style='text-align:center'>" qty_2 </td> 
    </tr>
    <tr>
    </table>
    ";"<tr></table>"; "</table>")

     I hope it might give some ideas. I would love to see the complete HTML that you're working with

  • DanAugust Profile Picture
    5 on at

    Oh my goodness, it was that easy? I need to brush up on my HTML skills! Thanks, WarrenBelz!

  • WarrenBelz Profile Picture
    155,315 Most Valuable Professional on at

    Hi @DanAugust ,

    Yes - easy to miss closing tags - a bit over overkill, but I tend to indent it all when I am developing as below so I can see opening and closing tags at all levels

    "
     <th>Product Name</th> 
     <th> Quantity Ordered</th>
    " &
    Concat(
     colShoppingCart,
     "
     <tr>
     <td style='text-align:center'>" & Description & "</td>
     <td style='text-align:center'>" & QTY & "</td>
     </tr>
     "
    )

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 899

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 499

Last 30 days Overall leaderboard