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?

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,080)