cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Memorable Member
Memorable Member

Re: Condition when a value doesn't exist

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
Highlighted
Memorable Member
Memorable Member

Re: Condition when a value doesn't exist

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (6,552)