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

Checking for empty date in Power Automate

I have a flow that is reading all rows from an Excel table.  If a specific date field is empty, I would like to perform one action and if not, perform another action.  I have tried numerous things and am getting the same result.  My test table has 8 rows, 4 have data in the date field, 4 do not. So within Apply to each 2, from a Condition step, I have tried:

 

- checking the field for null

- checking the field for nothing (leaving the left part of the condition empty)

- setting a variable with the value of the date field and checking that for null or nothing

- using empty = true

empty(items('Apply_to_each_2')?['Date of Returned Housing Referral(4326)'])

- checking the length = 0

length(items('Apply_to_each_2')?['Date of Returned Housing Referral(4326)'])
- using the Compose function with input = the date field, then using the Compose output in the condition statement (ran for both null and nothing)
One last bit - I am new to Power Automate. Trying to figure it all out!
 
I am out of ideas. Any suggestions would be much appreciated!
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @tverticchio 

 

It could be there are spaces there hence its not evaluating it. Try using a trim() expression for that field then check for length() or empty(). 

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

9 REPLIES 9
Ventit
Resolver II
Resolver II

Should be simply a condition based on Datefield is equal to null    - Use the expression box to add the null or just type null

Ventit
Resolver II
Resolver II

Another way is to initialise a string variable

 

Then set the variable to be the email column.  This will put it in an apply to each

 

Create your condition based on the string var.   now that it is a string you should be able to base the condition putting nothing in the is equal to   Eg  Stringvar is equal to 

 

or

 

length(stringvar) is equal to 0

tverticchio
Frequent Visitor

I have tried setting a variable and using that.  The condition always evaluates to false.

tverticchio_0-1653690180221.png

 

tverticchio
Frequent Visitor

Thank you for quick reply.  However, I have tried simply using the date field in the condition.  Tried to compare to null (function) as well as nothing.  Always evaluates to false. 

tverticchio_1-1653690475681.png

 

When you run the flow what does the variable show?

Ventit
Resolver II
Resolver II

I have an excel sheet that looks at an email column.  In this case the email can have many variable outcomes from user input.  So I set a variable to have the email and the add a compose with the following expression. If the email is invalid it will return false.  I set the condition to be based on that. my variable in this is called getemail

 

or(endsWith(variables('getemail'), '.'), startsWith(variables('getemail'), '.'), startsWith(variables('getemail'), '_'), startsWith(variables('getemail'), '@'), startsWith(variables('getemail'), '-'), contains(variables('getemail'), ' '), startsWith(variables('getemail'), '.'), contains(variables('getemail'), '<'), contains(variables('getemail'), '>'), not(contains(variables('getemail'), '@')), equals(length(variables('getemail')), 0), not(Contains(last(split(variables('getemail'), '@')), '.')), greater(length(split(variables('getemail'), '@')), 2), contains(variables('getemail'), ','),contains(variables('getemail'), '..'))
 
 
tverticchio
Frequent Visitor

Variable returns a value or spaces.  See below.  Either way the condition returns false... 

tverticchio_0-1653940545507.png

 

tverticchio_1-1653940429001.png

Should I be looking at something else? 

 

Hi @tverticchio 

 

It could be there are spaces there hence its not evaluating it. Try using a trim() expression for that field then check for length() or empty(). 

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
tverticchio
Frequent Visitor

Trim function did the trick.  Thank you!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,881)