Skip to main content

Notifications

Power Automate - Building Flows
Answered

Checking for empty date in Power Automate

Posted on by 64

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!
  • tverticchio Profile Picture
    tverticchio 64 on at
    Re: Checking for empty date in Power Automate

    Trim function did the trick.  Thank you!

  • Verified answer
    abm abm Profile Picture
    abm abm 32,250 on at
    Re: Checking for empty date in Power Automate

    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

  • tverticchio Profile Picture
    tverticchio 64 on at
    Re: Checking for empty date in Power Automate

    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? 

     

  • Ventit Profile Picture
    Ventit 392 on at
    Re: Checking for empty date in Power Automate

    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'), '..'))
     
     
  • Ventit Profile Picture
    Ventit 392 on at
    Re: Checking for empty date in Power Automate

    When you run the flow what does the variable show?

  • tverticchio Profile Picture
    tverticchio 64 on at
    Re: Checking for empty date in Power Automate

    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

     

  • tverticchio Profile Picture
    tverticchio 64 on at
    Re: Checking for empty date in Power Automate

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

    tverticchio_0-1653690180221.png

     

  • Ventit Profile Picture
    Ventit 392 on at
    Re: Checking for empty date in Power Automate

    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

  • Ventit Profile Picture
    Ventit 392 on at
    Re: Checking for empty date in Power Automate

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard