cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

replacing multiple strings using replace

Hi,

 

I have created a flow which gets table from a excel file, > convert it into an HTML table > Send an email with the HTML table in the body of the email.

 

HTML table does not have any boarders, hence I used the following replace string within "compose"

 

replace(body('Create_HTML_table'),'<table>','<table border="1" cellspacing="0" cellpadding="0">'
 
this works perfectly. Now, in additional to the above I want to bold one cell content, which I think could be done with the replace(). the expression I wrote was below.
 
replace(body('Create_HTML_table'),'<td>Total</td>','<td><em><strong>Total</strong></em></td>'
 
The issue I have is how to have multiple replace strings on the same output. I built two replace functions within the same compose action. It gave two tables one with first replace string applied and another copy of the same table with only the 2nd replace string applied.
 
3 REPLIES 3
Dual Super User II
Dual Super User II

Hi @MafazAnsar 

 

Can you try this: 

 

replace(replace(body('Create_HTML_table'),'<table>','<table border="1" cellspacing="0" cellpadding="0">'),'<td>Total</td>','<td><em><strong>Total</strong></em></td>') 
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 

 

I tried your suggestion, however it gives the following failure notice,

 

'The template language function 'replace' expects three string parameters: the string to replace characters inside of as the first parameter, the string that will be replaced by the new string as the second parameter, and the new string as the third parameter. The function was invoked with '4' parameter(s). Please see https://aka.ms/logicexpressions#replace for usage details.'.

 

So far I was able to accomplish the requirement with the help of multiple 'compose', each with one replace string with in. But I wish there is a shorter version to it.

Hi @MafazAnsar 

 

I tested on my end and the expression seems to be working fine for me. Can you check once and try again? And maybe share a screenshot of the expression that you have? 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (43,814)