I have the following Flow that runs a report of Field trips from Sharepoint lists and then emails an HTML table (see Flow-overview.PNG)
I am then trying to do 2 things which are not working:
I'm trying to use substitute to separate out people's names from a long string that looks like this:
Joe Louis ; WARREN SMITH; Timothy Idesfelt ; Thomas Jones; * *
I would like it to look like: Joe Louis, WARREN SMITH, Timothy Idesfelt, Thomas Jones
My code looks like this and is not working at all:
<td>& " Substitute(Substitute(Substitute(@{items('Apply_to_each_2')?['officers']},";",""),"* *","")," "," ")" &</td>
The 2nd thing I am trying to achieve is to format the status cell with a red background and bold white font color IF the value of status is equal to Pending - this the code I have for that one:
<td & if equals item()?['@{items('Apply_to_each_2')?['status/Value']}'],'Pending',style=''background-color:red; color:white; font-weight:bold''','')>@{items('Apply_to_each_2')?['status/Value']}</td> see Flow-detail.PNG as well
any assistance greatly appreciated thank you
I have made some progress on the above problem and have managed to get the word "Pending" formatted in red in the Status column of my HTML table. However this is what I get:
{"Status":"Approved"}
[{"Status":"Pending"}]
so, my syntax is a little wrong obviously
can anyone help please @Reza @WarrenBelz
Update: I have resolved the 1st problem I had by using Replace instead of Substitute (I found out that Substitute is not a supported function in Power Automate)
For the benefit of others viewing this post I used a Compose action on the Officers field (which has multiple names in a string) and this code to replace the semi colons and asterisks with nothing:
@lbendlin I only have the one single quote character on my keyboard - the one below the double quote character - that's the one I am using....
make sure to use the straight single quote, not any of the slanted accents.
@lbendlin thanks for that
when I try that I get the attached result in the HTML table - notice how the ' character is going into the next table definition.....I must have missed something...
sort of. Note that PowerAutomate uses single quotes, not double quotes.
more like this
'<td>' & Substitute(Substitute(@{items('Apply_to_each_2')?['officers']},';',''),'* *','') & '</td>'
@lbendlin Hi - do you mean put quote characters like this:
'<td>'& " Substitute(Substitute(Substitute(@{items('Apply_to_each_2')?['officers']},";",""),"* *","")," "," ")" &'</td>'
you need to treat the HTML code as text.
So instead of
<td>
you need to use
'<td>'
etc.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.