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

Notifications

Announcements

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
    153,079 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
    153,079 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard