cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Larry_Casey
Helper II
Helper II

Flow is unable to compare dates using NULL and OR

Hello,

 

I have a super simple flow that doesnt seem to work.  Basically I am comparing two date fields, but 1 of the dates may be null.

 

I am using an OR condition to check if event Date is greater than the last event date OR the Last Event Date is Null.

 

The flow fails every time  when the Last Event Date is Null.  But I have setup the logic correctly and it would seem that this should work. But it fails every time the last event date is null. Why doesn't flow work as expected here?

 

01.png

 

 

InvalidTemplateUnable to process template language expressions for action 'Condition' at line '1' and column '2706': 'The template language function 'greaterOrEquals' expects two parameter of matching types. The function was invoked with values of type 'String' and 'Null' that do not match.'.

20 REPLIES 20
abm
Super User
Super User

Hi @Larry_Casey 

 

Try the following:

 

What's the data type here? For checking null try empty() or length() expression. 

 

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
ChristianAbata
Super User
Super User

hi @Larry_Casey  you coud use insted null the fuctions empty if the field are you receibe no have values.

If your output is null you can try String(null)



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

I dont see anywhere in the interface to add what you are saying.   The logic in Flow is correct.  The product simply isnt working as the picture I provided should work according to Microsoft documentation.

Looking at the error message it seems that either your Event date  or the Last event date in the first part of the condition is empty.

Rob
Los Gallardos

@Larry_Casey  try this

here.PNG



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

That is an Invalid Expression. Flow will not Accept Empty

 

01.png

Pstork1
Dual Super User III
Dual Super User III

First, Date columns are never null. If a date value isn't filled in it always defaults to some minimal date.  The actual date would depend on the data source involved.  The other potential problem is that you may ahve a mismatch between Event Date and Last Event date in terms of the data type.  It sounds from the error like one is a date/time field and the other is a string.  please check the data types involved and let us know what they are.  Then we can help you resolve the issue.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

hi @Larry_Casey  allways close the fuction like this empty()



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

I have tried all the following:

 

Last_Event_Date is Equal to Empty()   -- Same Error

Last_Event_Date is Equal to String(Null)   -- Same Error

Last_Event_Date is Equal to String(Empty())   -- Same Error

 

Nothing is working.

hi @Larry_Casey  could you share with us the output from sharepoint? the json output please



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

For the Empty() I receive this:

 

Unable to process template language expressions for action 'Condition' at line '1' and column '2706': 'The template language function 'empty' expects one parameter: the object, array or string to test for emptiness. The function was invoked with '0' parameter(s). Please see https://aka.ms/logicexpressions#empty for usage details.'.

Hi @Larry_Casey 

 

You need to check empty check like this.

 

image.png



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

How can I check for empty like that in the OR condition?

 

Basically I just need to know whether the Last_Event_date is empty OR the Event_Date is Greater than or equal to the Last_Event_Date.

 

Then apply an action if True.

 

 

01.png

01.png

No matter what I try, Even if I remove the OR, Flow can not determine if a date field is empty.

 

This must be an Outage.  I encourage anyone in this forum to try and you will see.

 

  • Simply create two date Fields in a SharePoint List.
  • Name them: Event_Date and Last_Event_Date   (They are date fields)
  • Leave the Last_Event_Date empty
  • Then try to determine if the Last_Event_Date is empty.

    Last_event_Date is empty, null, blank, string(null) etc...... I have ran through every single possible combination and flow will never recognize that a date field is empty. It returns false every single time.

 

 

@Larry_Casey  could please you copy an paste what is inside of get items?



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

All,

 

I have found the solution and really appreciate all your assistance and help. Everyone here contributed to finding the answer. I am not a programmer so this is all really new to me and now it makes sense. There is no Power Automate outage 😉

 

I had to use the following which was mentioned, but I didn't realize I needed to add the field value to empty.

 

Empty(item()?['Last_Event']) is equal to  True
 
So the  condition looks like this:
 

 

01.png

@abm   I now understand what you were telling me.  I did not realize I needed to use the field value in the empty string

 

Empty(item()?['Last_Event']) is equal to  True
 
I am not a programmer so it took me a minute to figure out the correct syntax for empty
 
Thanks again!
 
Pstork1
Dual Super User III
Dual Super User III

The problem is that if you don't set a default date on a date in SharePoint then Flow doesn't return that field in the results unless its filled in.  So you can't test if the date value is Null because the field itself isn't included in the JSON results when you do a Get Item or Get Items.  If you look at the JSON in your runs you'll see that the field itself is missing from some of the records.  I think the only way to make this work is to default the date in SharePoint to some date in the distant past and then check against that date when you would check to see if its null.  But at least if there was a date there then the field would be returned.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,716)