Hello - Are you doing this comparison on a Nintex form, or inside a Workflow?
So.. I tried this in Forms (just to see what would happen) .. and..
Lemme see if I can get around this and report back..
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...
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
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 ...
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.
I'm actually working with a Workflow.
Thanks for this work! I'm actually working in a worflow. Perhaps i could apply the same logic.
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).
In Nintex Form I created 2 single texts called D1 and D2 with default value 2/17/2017 for both.
A-I Checked the client side code for it, so I found the following comparison function:
fn7905523dfeed40d7a33b0cb269f10b57(sourceContext, rowIndex)
{
return
NWF.FormFiller.Functions.GetValue('7d3491e7-b81f-4e70-aa48-109db3262252', sourceContext, 'string')
==
NWF.FormFiller.Functions.GetValue('09f2e33d-576c-40ec-8563-663ed01f69d7', sourceContext, 'string') ;}
}
B-When I checked the values of:
NWF.FormFiller.Functions.GetValue('7d3491e7-b81f-4e70-aa48-109db3262252', sourceContext, 'string')
and
NWF.FormFiller.Functions.GetValue('09f2e33d-576c-40ec-8563-663ed01f69d7', sourceContext, 'string')
It returned
Fri Feb 17 2017 00:00:00 GMT+0200 (Middle East Standard Time)
and
Fri Feb 17 2017 00:00:00 GMT+0200 (Middle East Standard Time)
C-When I checked the type:
typeof NWF.FormFiller.Functions.GetValue('7d3491e7-b81f-4e70-aa48-109db3262252', sourceContext, 'string')
it returned
"object"
B-When I checked the properties of the object:
for(var prop in NWF.FormFiller.Functions.GetValue('7d3491e7-b81f-4e70-aa48-109db3262252', sourceContext, 'string')){console.log(prop);}
it returned
format
localeFormat
toFormattedString
Here the essence result: There is not a comparer method to compare the 2 objets
So the result is false
But if I compare
NWF.FormFiller.Functions.GetValue('7d3491e7-b81f-4e70-aa48-109db3262252', sourceContext, 'string').toString()
==
NWF.FormFiller.Functions.GetValue('09f2e33d-576c-40ec-8563-663ed01f69d7', sourceContext, 'string').toString()
it will return true
Solution:
So instead of having D1==D2 in the formula you can have (D1+"")==(D2+"")
when you are not sure of the input format
Cheers...
Hello Candace,
Did you ever figure out what you needed within the workflow (I know this discussion took a turn towards forms but it was a workflow solution you were looking for if I'm not mistaken)?
Thanks
Mike
nice hack!
few notes, though.
1. I think you documented it for date controls and not for single line text ones.
text controls do not convert to date object on their own.
at least I'm not able to make it convert whatever text input resembling to a date I provide to text control.
2. it's important to realize that this kind of comparison can only work for equality.
it simply makes alphabetical comparison, not date value comparison.
so, "Fri Feb 17 2017..." is NOT greater then "Thu Feb 16 2017..."
Dear ,
It's a single line of text...Are u using SP2013 or SP2016?
Which Nintex Forms version?
tested it on 2.7.0.0 and 2.9.4.0
Terrific! I have also been struggling with this - what seems like a very basic concept, too. Also thanks for the information on handling greater than (less than) situations.