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

[Help Needed] Conditional Formatting Body Text

Hello,
I am currently struggling with setting up a flow that would have conditional text inserted on its body.
The condition is based on an Excel table, in order to exemplify, lets say that I have the ID column, and then I have 4 different columns named (Document 1, Document 2, Document 3, Document 4), each of these columns are going to be populated with an "X" or a "Yes".

 

The goal would be to write an email as follows:
"Hello (Name)
We are contacting you regarding your documentation, as follows:

  • "if the content in column Document 1 is blank", insert text "(TEXT DOCUMENT1), if not, insert nothing.
  • "if the content in column Document 2 is blank", insert text "(TEXT DOCUMENT2), if not, insert nothing.
  • "if the content in column Document 3 is blank", insert text "(TEXT DOCUMENT3), if not, insert nothing.
  • "if the content in column Document 4 is blank", insert text "(TEXT DOCUMENT4), if not, insert nothing.

This way the body of my email would address each missing item for each person.
I am having difficulties with creating an "IF" function that would look into my column and according to the result of the function either insert a text in the Email's body or do nothing.


1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @mottandre,

 

You could use the if and equals functions for that and look for the X value.

 

Below is an example of that.

This example works with a List rows present in table and apply to each action. You might need to amend the column names in the expressions. And also the li html tags are rendered when there is nothing. 

 

<p>Hello (Name)<br>
We are contacting you regarding your documentation, as follows:<br>
</p>
<ul>
  <li>@{if(equals(items('Apply_to_each')?['Document1'], 'X'), 'Some Random Text 1', '')}</li>
  <li>@{if(equals(items('Apply_to_each')?['Document2'], 'X'), 'Some Random Text 2', '')}</li>
  <li>@{if(equals(items('Apply_to_each')?['Document3'], 'X'), 'Some Random Text 3', '')}</li>
  <li>@{if(equals(items('Apply_to_each')?['Document4'], 'X'), 'Some Random Text 4', '')}</li>
</ul>

 

document_iftext.png

 

Hope this helps to get you started?

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @mottandre,

 

You could use the if and equals functions for that and look for the X value.

 

Below is an example of that.

This example works with a List rows present in table and apply to each action. You might need to amend the column names in the expressions. And also the li html tags are rendered when there is nothing. 

 

<p>Hello (Name)<br>
We are contacting you regarding your documentation, as follows:<br>
</p>
<ul>
  <li>@{if(equals(items('Apply_to_each')?['Document1'], 'X'), 'Some Random Text 1', '')}</li>
  <li>@{if(equals(items('Apply_to_each')?['Document2'], 'X'), 'Some Random Text 2', '')}</li>
  <li>@{if(equals(items('Apply_to_each')?['Document3'], 'X'), 'Some Random Text 3', '')}</li>
  <li>@{if(equals(items('Apply_to_each')?['Document4'], 'X'), 'Some Random Text 4', '')}</li>
</ul>

 

document_iftext.png

 

Hope this helps to get you started?

View solution in original post

Hello Dennis!
I really appreciate the attention and the time taken! I will be going through my data and making some tests and I will come back to either change this question to Solved or to ask another further detail, best regards!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,214)