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

Using compose to replace multiple strings

(1) ShareShare
ReportReport
Posted on by

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,865 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,865 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

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 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard