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

Inserting text with an If expressions and dynamic content

Hi All,

I'm making a flow where a Planner task is built when a Form response is submitted. The form has a feield for the given and surname of client 1 and then client 2.

I want to name the Planner task as [Client 1 Surname] & [Client 2 Surname]. 
However, sometimes the there will only be one client completing the form.

I'm trying to get a variable to insert the '&' only if there is a value in [Client 2 Surname]. If I just type '&' between the dynamic content for the two surnames, it will look unfinished and people will think something is missing.

I tried a variable with and if(equals) but I get nothing but errros so this is over my head.

Would appreciate any help you can provide.
Thanks!!
 
1 REPLY 1
Expiscornovus
Super User
Super User

Hi @MrNPP,


You could use a combination of if, not, empty and concat functions.

 

Below is an example:

First check the content of the questions are both not empty. 

 

not(empty(outputs('actionname')?['body/question1']))

 

 

Use an and to combine the two checks for both questions.

 

and(expressiona,expressionb)

 

 

Use an if to concatenate when true. When true concat with &. When false concat without &.

 

if(expression, iftrue, iffalse)

 

 

All together in one expression:

 

if(and(not(empty(outputs('Get_response_details')?['body/rc967dd6f6e95478da8f0d470ea418406'])),not(empty(outputs('Get_response_details')?['body/rbf2a89d1c4d0482c840c06a7df4f1a6d']))), concat(outputs('Get_response_details')?['body/rc967dd6f6e95478da8f0d470ea418406'], ' & ', outputs('Get_response_details')?['body/rbf2a89d1c4d0482c840c06a7df4f1a6d']), concat(outputs('Get_response_details')?['body/rc967dd6f6e95478da8f0d470ea418406'],outputs('Get_response_details')?['body/rbf2a89d1c4d0482c840c06a7df4f1a6d']))

 

 

ifnotempty_and.png

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,772)