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 / Using compose to repla...
Power Automate
Answered

Using compose to replace multiple strings

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I used this video to setup a flow to create pdf from form input responses.

 

Everything is working perfectly, but I want to do it in one compose action.I have 33 form fields so I would rather not have 33 compose steps like he suggests in the video.

 

I can't figure out how to write the replace expression in a single compose step to replace multiple strings in the HTML. He says it's possible in the video, but doesn't say how. If I do multiple replace statements, I assume it will duplicate the output from the 'get file content' step. 

 

Thanks in advance

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at


    Hi,

    Here it is

     

    I have a string called 'ABC' and I want to replace 'A' with 1, 'B' with 2 and 'C' with 3, so the final result I am expecting is '123'

     

    So to replace A with 1 we need the below expression

    replace('ABC','A','1')

     

    To replace the A & B we need the below expression
    replace(replace('ABC','A','1'),'B','2')


    To replace the A, B & C we need the below expression
    replace(replace(replace('ABC','A','1'),'B','2'),'C','3')


    The idea is copy the first expression (A) into next replace (duplicate the first one) and so on. The only issue with this is if something goes wrong its difficult to debug from run history. If you have different compose then its easier to find each results.

  • viyer Profile Picture
    48 on at

    Hi,

     

    I am trying to achieve the same but unable to implement. Following is my html template where i have multiple strings and need to replace the {values} with sharepoint list items using single compose action.

     

    <table width="400" border="1">
    <tbody>
    <tr>
    <td style="background-color:cornflowerblue" align="left"><b>Summary</b></td>
    <td style="background-color:skyblue" colspan="3" align="right">{summary}</td>
    </tr>
    <tr>
    <td style="background-color:cornflowerblue"><b>Supplier Name</b></td>
    <td style="background-color:skyblue">{suppliername}</td>
    <td style="background-color:cornflowerblue"><b>Date</b></td>
    <td style="background-color:skyblue">{date}</td>
    </tr>
    </tbody>
    </table>

     

    Please let me know how i can achieve this.

  • viyer Profile Picture
    48 on at

    Hi,

     

    I am trying to achieve the same but unable to implement. Following is my html template where i have multiple strings and need to replace the {values} with SharePoint list items using single compose action.

     

    <table width="400" border="1">
    <tbody>
    <tr>
    <td style="background-color:cornflowerblue" align="left"><b>Summary</b></td>
    <td style="background-color:skyblue" colspan="3" align="right">{summary}</td>
    </tr>
    <tr>
    <td style="background-color:cornflowerblue"><b>Supplier Name</b></td>
    <td style="background-color:skyblue">{suppliername}</td>
    <td style="background-color:cornflowerblue"><b>Date</b></td>
    <td style="background-color:skyblue">{date}</td>
    </tr>
    </tbody>
    </table>

     

    Please let me know how I can achieve this.

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @viyer 

     

    Could you please create a new thread for this?

     

    Thanks

  • viyer Profile Picture
    48 on at

    Hi @abmgs 

     

    Thanks for your response , I have created a new thread for this issue.

    https://powerusers.microsoft.com/t5/Building-Flows/Replace-multiple-values-using-single-compose-action/td-p/791653

     

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard