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 Automate / How to join 2 expressi...
Power Automate
Unanswered

How to join 2 expression together

(0) ShareShare
ReportReport
Posted on by 2

I have used the below successfully and its working

replace(body('Create_HTML_table'),'<table>','<table border="3"> ')

 

Now I also want to use the below to high light if it meets a particular text - tested its working fine

replace( body('Create_HTML_table'), '<td>PC400-7</td>', '<td style="background-color:#ADD8E6">PC400-7</td>')

 

but I am unable to join together, its getting error.

Please advise how to join together in one expression.

Categories:
I have the same question (0)
  • David- Profile Picture
    1,254 on at

    Without seeing your workflow, I don't know if you are doing the same thing as I am, but here goes...

     

    In your Select action for generating the table, format the value as:

    David_0-1659641181277.png

    Use an if expression to set the color. I am checking a date and using this expression:

    if(less(div(sub(ticks(item()?['ExpirationDate']),ticks(utcNow())),864000000000),7),'yellow','none')

    The second expression is just the value I want to show in the field (a date in this instance). It results in:

    David_1-1659641363128.png

     

    You may need to put a compose action after the Create HTML table action, as the <, > and quotes will get escaped out when the table is generated. Just use this expression in the Compose action:

    replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&gt;','>'),'&quot;','"')

     

  • Ellis Karim Profile Picture
    11,983 Super User 2026 Season 1 on at

    Hi @MIA27 ,

     

    If you want to merge both expressions into a single expression, then try:

     

    replace( replace(body('Create_HTML_table'),'<table>','<table border="3"> '), '<td>PC400-7</td>', '<td style="background-color:#ADD8E6">PC400-7</td>')

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • MIA27 Profile Picture
    2 on at

    Dear Mr. Ellis,

    Thank you so much. Tested and it worked. It color the match in the table output of email. As it was a test on a text Field.

    But for the actual requirement, I want to test further by your guidance,

    Is it possible to use the same method with If ?

     

    I mean I have a renewal date field in the same table.

    I want to color blue If RenewalDate = Today or Today+15

    I want to color Red If RenewalDate = Less than today

     

    Please advise.

     

     

  • MIA27 Profile Picture
    2 on at

    I want to test your method as it seems it same requirement of mine, please also refer my reply post to Mr. Ellis.

     

    Please clear the second expression which your used was as below (as it is not showing in the image:

    Format(ExpirationDate, 'dd-mm-yyyy')     This way or you took the reference of the first expression of if.

     

    Please guide me to complete this and learn.

    As planning to make same like you, instead of htlm table, I will go for select and then compose it

     

    Currently my flow is as below :

     

    MIA27_0-1659675883478.png

     

  • Ellis Karim Profile Picture
    11,983 Super User 2026 Season 1 on at

    Hi @MIA27 ,

     

    Yes, I think what you want to do is possible.  I suggest watching the following tutotal by Reza Dorrani on how using Power Automate to format HTML Tables: https://youtu.be/VnWg-Eox37Q

     

    Snag_3de8a451.png

    Snag_3de8e513.png


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • David- Profile Picture
    1,254 on at

    I am on vacation for the next week, so I probably will not look at this until I return, but are you asking how to do this and if it is possible?

     

    I want to color blue If RenewalDate = Today or Today+15

    I want to color Red If RenewalDate = Less than today

     

    This should be possible by combining the expressions. I usually test this out by building them through a button flow with a Date trigger, then follow it with a Compose action to create the expressions and quickly test to see if it works as desired. This article provides tips for how to approach this: https://tomriha.com/how-to-combine-expressions-in-your-power-automate-flows/

     

    These are the expressions I built in a button flow to test:

    1. if(less(triggerBody()['date'],utcNow()),'red','none')

    2. if(equals(triggerBody()['date'],utcNow()),'blue','none')

    3. if(greater(triggerBody()['date'],addDays(utcNow(),15)),'blue','none')

    4. if(less(triggerBody()['date'],utcNow()),'red',if(equals(triggerBody()['date'],utcNow()),'blue',if(greater(triggerBody()['date'],addDays(utcNow(),15)),'blue','none')))

    The first one is for today, the second is equal to today, the third is greater than 15 days and the fourth is the combined expression. You would replace the triggerBody with your field that you want to evaluate.

     

    Question though, do you want no highlight if the renewal date is between 2 and 14 days from the current date? If not, replace none with whatever color you want instead.

     

    Are you also asking what expression I am using for the formatDateTime in my Expiration date in my image? If so, it is just formatDateTime(item()?['ExpirationDate'], 'D')

  • MIA27 Profile Picture
    2 on at

    Dear Ellis,

    Saw Reza video, found the example he showed is based on a text field, not on a date field.

    Trying but getting wrong result, not successful.

     

  • MIA27 Profile Picture
    2 on at

    Dear David,

    Thank you for your advise. I copied your advised expression and pasted in the new compose expression:

    if(less(triggerBody()['InqDate'],utcNow()),'red',if(equals(triggerBody()['InqDate'],utcNow()),'blue',if(greater(triggerBody()['InqDate'],addDays(utcNow(),15)),'blue','none')))

     

    MIA27_0-1659808524187.png

     

    Could not understand where is the mistake, Above screen also for your preview how my flow,

    Please guide.

     

     

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard