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 Automate / Create one HTML table ...
Power Automate
Unanswered

Create one HTML table but with multiple rows unwanted

(0) ShareShare
ReportReport
Posted on by

I'm currently creating a HTML table using Power Automate. But my question is that, when the count number is larger than 5, i will create a HTML table and send out an email that includes it to myself. However, I find that due to the inevitable apply to each in the condition, the HTML table I've created will be made of duplicated rows, which is not i want. I want to combine all the materials from get items in one table and send out to myself. How to do that?

Yue_Jiang_0-1713507920167.pngYue_Jiang_1-1713507933177.png

Screenshot 2024-04-19 142546.png

This is the email i receive. 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Yue_Jiang 

     

    Use filter query in "Get items" action to get the filtered data. This will avoid apply to each action and condition. When you get filtered data directly from get items action, you can use "Select" action to select the required columns from the output of get items action. Pass the output of select to "Create HTML table" action and then share the output of html action in the email body.

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • CU-20080800-0 Profile Picture
    on at

    Thank you so much for replying to me. But the question is that i have to use condition since under yes, I also have some actions that i don't show in my post. Is there any better solution to it?

  • v-yetonggu-msft Profile Picture
    on at

    Hi @Yue_Jiang ï¼Œ

    Please try use Initial variable and append to array variable:
    I did a test for your reference.

    In my scenario:

    The Result:

    vyetonggumsft_0-1713514768756.png

    My Flow:

    vyetonggumsft_2-1713514870529.png

     

    {
    "Material":@{items('Apply_to_each')?['Material']},
    "Trade Name":@{items('Apply_to_each')?['TradeName']},
    "Product Name":@{items('Apply_to_each')?['ProductName']},
    "Supplier Name":@{items('Apply_to_each')?['SupplierName']}
    }

     

    Best Regards,

    Sunshine Gu

  • CU-20080800-0 Profile Picture
    on at

    Dear Sunshine Gu,

    Thank you so much for your help! I've tried your method but I find that If I have two rows of information, i will receive two emails: The first email contains a single row HTML table, the second email contains two rows of HTML table (this is what i want). I don't know why there is such a problem. 

    1.png

    2.png

  • v-yetonggu-msft Profile Picture
    on at

    Hi @Yue_Jiang ,

    Take Create html table out of Apply to each:

    vyetonggumsft_0-1713516891039.png

    vyetonggumsft_2-1713516981151.png

    Best Regards,

    Sunshine Gu

  • CU-20080800-0 Profile Picture
    on at

    Hi, Sunshine Gu. Thank you so much for your advice. But there are corresponding actions under True and False, i cannot directly get HTML table out of the Apply to each. Is there any better solution?

    Yue_Jiang_0-1713746889158.png

     

  • Verified answer
    v-yetonggu-msft Profile Picture
    on at

    Hi @Yue_Jiang ,

    You can create two branches, one branch gets records with Count Emails greater than or equal to 5, if the length of Get items is greater than 0, create an HTML table and send an email, and the other branch gets records with Count Emails less than 5.

    vyetonggumsft_2-1713849316058.png

    Count_x0020_Emails ge '5'
    Count_x0020_Emails lt '5'

    vyetonggumsft_3-1713849770573.png

    length(outputs('Get_items')?['body/value'])
    
    {
     "Material": @{items('Apply_to_each')?['Material']},
     "Trade Name": @{items('Apply_to_each')?['TradeName']},
     "Product Name": @{items('Apply_to_each')?['ProductName']},
     "Supplier Name": @{items('Apply_to_each')?['SupplierName']}
    }

    My Outlook Inbox:

    vyetonggumsft_4-1713849802742.png

    Best Regards,

    Sunshine Gu

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard