cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aaron-powell
New Member

Condition when a value doesn't exist

I'm wanting to create a Flow that looks at values coming in from an Office Form and if an optional value was provided with a value then do something, otherwise do something else.

 

I've created a condition like so:

 

Capture.PNG

 

Thinking that I could check if it against an empty string, but that doesn't capture it the way I want it to (it never equals empty string).

 

I can't seem to work out anything else like "has no value", so is there any way that I can achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
faustocapellanj
Memorable Member
Memorable Member

Hi @aaron-powell,

 

Whenever you are checking a condition against an empty value, you want to use the expressions equals and coalesce combined in one statement. For example, you need to edit the condition in advanced mode, and once in advanced mode, you build the expression as shown below:

@equals(coalesce(body('Get_response_details')?['r4ffd584a0a804e80a51ee092553d14db'],''), '')

So you can understand the expression better, look at it from inward out. This is your body from the Get response details step:

body('Get_response_details')?['r4ffd584a0a804e80a51ee092553d14db']

Then the coalesce function checks for null. 

coalesce(body('Get_response_details')?['r4ffd584a0a804e80a51ee092553d14db'],'')

And once the coalesce function returns the null value, then the equals function checks for this null value, which you can find on the first expression I posted above. Below is the screenshot from my condition.CheckNullValue.JPG

Please let me know if you have any questions.

 

Regards,

Fausto Capellan, Jr

 

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

View solution in original post

1 REPLY 1
faustocapellanj
Memorable Member
Memorable Member

Hi @aaron-powell,

 

Whenever you are checking a condition against an empty value, you want to use the expressions equals and coalesce combined in one statement. For example, you need to edit the condition in advanced mode, and once in advanced mode, you build the expression as shown below:

@equals(coalesce(body('Get_response_details')?['r4ffd584a0a804e80a51ee092553d14db'],''), '')

So you can understand the expression better, look at it from inward out. This is your body from the Get response details step:

body('Get_response_details')?['r4ffd584a0a804e80a51ee092553d14db']

Then the coalesce function checks for null. 

coalesce(body('Get_response_details')?['r4ffd584a0a804e80a51ee092553d14db'],'')

And once the coalesce function returns the null value, then the equals function checks for this null value, which you can find on the first expression I posted above. Below is the screenshot from my condition.CheckNullValue.JPG

Please let me know if you have any questions.

 

Regards,

Fausto Capellan, Jr

 

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,038)