cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

Condition on Date Values Returns False instead of True

I have two single line of text variables:

  • Variable A
  • Variable B

Both of the variables contain text that looks like a date (ex: 2/17/2017)

I set up a condition that says: If Variable A = Variable B do this...

But my condition is failing.

I have an instance where Variable A = 2/17/2017 and Variable B = 2/17/2017 yet the condition returns as False.

Am i not able to compare these values because of the format? Do i need to convert them back to date/time format to compare them??

Reply
18 Replies
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

Hello - Are you doing this comparison on a Nintex form, or inside a Workflow?

Reply
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

So.. I tried this in Forms (just to see what would happen) .. and..


Lemme see if I can get around this and report back..

Reply
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

Ah, I think I found a way around this (if it's forms...)

The only way within the form I could find a good way to compare the dates (and I also tried to ConvertToDate for a full date string.. it didn't like that either..) was to look at the difference of days between them. If there are 0 days, that's the same date. 

I guess I could've also written, "if(isNullOrEmpty(dateDiffDays(date1,date2)),"true","false")" but I wanted to show both parts clearly. 

Good to know for the future, even if forms isn't your issue here...  

Reply
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

The  "greaterThan"...  variations of the rule should work as well.   I just used this rule the other day to check and make sure "End Date" wasn't prior to a "Start Date" on a form.   Let me know if you find that it works for you as well

Reply
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

It seems to not quite work the same if you want to see if they equal eachother, rather than "is one greater than" - and I could see it failing to choose equals, but displaying a truth because of the greater than ...

Reply
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

Right on, I wouldn't use the GreaterThan(s) either to compare for equality unless I also wanted the truth to include that logic, but was just noting that it was optional for those cases.     

Reply
Highlighted
Nintex Newbie

Re: Condition on Date Values Returns False instead of True

I'm actually working with a Workflow. 

Reply
Highlighted
Nintex Newbie

Re: Condition on Date Values Returns False instead of True

Thanks for this work!  I'm actually working in a worflow. Perhaps i could apply the same logic. 

Reply
Highlighted
Automation Master
Automation Master

Re: Condition on Date Values Returns False instead of True

could you post screenshot of how you set up your comparison?

try to write both variables to workflow log to see whether they really contain value you expect to. take special care whether they do not contain any leading or trailing space(s).

Reply