Solved

Nintex Date Difference Condition

  • 26 April 2022
  • 3 replies
  • 602 views

Hello, I have a Nintex form and workflow connected to a SharePoint list. 

The form is a temporary account creation request form, and I have a Date/Time field on the form called "Set Expiration Date". When the expiration date is 14 days or less away from the day the form is being submitted, it requires Person 1's signature. If the expiration date is more than 14 days away, it goes to Person 2 for an approval signature. 

I have a "Set a Condition" action on my workflow to set this above condition, and make the workflow go in which ever direction based on what expiration date is set on the form. Although no matter what, even the number of days are greater than 14, the condition ALWAYS goes to which ever side I set the less than or equal to 14 to. I tried flipping the condition too to see if this would magically fix it, but it still goes to the <=14 side no matter the number of days difference. 

 

I have tried just about everything my mind can think of. This is what I have done so far: 

 

  • Created VarExpirationDate to store expiration date, tried storing as Date and Time, and Integer. 
    • I used this in a Math Operation to calculate "VarExpirationDate   Minus   Current Date" Storing it as "VarIntDateDif", then using this in the condition afterwards which is "Is less than or equal to, Value, 14"   -> Didn't fix it. 
  • Then I tried creating a calculated field on the form with below configuration (Successfully returns number of days difference on the form as a clean integer) 

22771i9BEE7F4A58EA8C92.png

 

  • I used this field from the form named "ExpDateDiff" in the Condition action, directly using the field name (If Current Item, ExpDateDiff, is les than or equal to, value 14) which still resulted in the workflow going to the "<=14" side no matter what. -> Didn't work
  • I tried storing the Form field ExpDateDiff into the variable "VarIntDateDif" and doing the same, and still same results. -> Didn't work

22772i3AF6E3F94422AD2A.png

 

Just for the sake of testing my function, I tried using a Run Parallel Action and put two Run If actions with one of the conditions being "<=14" and one being ">14", using the same exact configuration I had used for the Condition action. Then, the workflow had successfully chosen the correct side, but of course I couldn’t use this since I would need the workflow to continue moving on with only one or the other. 

 

I've tried changing the Variable types, made sure the value types align across all three platforms, and have just about tried everything I can think of. If you can see something that I am not and could please help me I would greatly appreciate it!!

 

icon

Best answer by Mjks_321 28 April 2022, 01:16

View original

3 replies

So, after days of straight testing I finally found a solution and wanted to share it in case someone has a similar problem. 


 


Main issue was variable type. I was using Integer, hoping it would return a clean number of days difference between two dates. I changed all my variables to use Number type instead, and then I got these huge numbers like 3860006400 or 6007490034, but they were always constant with the given variable, it didn't change around. I later found out through some research that these are the number of seconds since 1/1/1900. 


So, I created variables for Todays Date and Expiration Date and stored the calculated difference  in a Number type variable.  


In my condition, I just calculated what 14 days would be in seconds which was 1209600 seconds, and used this in the condition action. It looked like this in the end: 



And it worked great!! What seemed to be a simple condition had a simple problem, but it was a journey to find. Hope this can help someone! 


 

So, after days of straight testing I finally found a solution and wanted to share it in case someone has a similar problem. 


 


Main issue was variable type. I was using Integer, hoping it would return a clean number of days difference between two dates. I changed all my variables to use Number type instead, and then I got these huge numbers like 3860006400 or 6007490034, but they were always constant with the given variable, it didn't change around. I later found out through some research that these are the number of seconds since 1/1/1900. 


So, I created variables for Todays Date and Expiration Date and stored the calculated difference  in a Number type variable.  


In my condition, I just calculated what 14 days would be in seconds which was 1209600 seconds, and used this in the condition action. It looked like this in the end: 



Hope this helps! 

Tested another method, which unfortunately didn't work again. 


I created a variable called "VarToday+14Days" (Integer Type) using the Math Operation action, which holds the value of the Current Date + 14 days, so in other words, 14 days from the current date. 


 


I then entered into my condition action, "Current Date <= VarToday+14Days", and now I am running into the exact opposite issue where no matter how far the expiration date is, 1 day or 100 days away, it is now always going to "No", or to the Expiration date is more than 14 days away side. 


 


After continuing to test different things, I found that the Variable type - Number, stored the dates as number of seconds since 1/1/1900. So, using this I was then able to use the condition correctly. 


I stored the Expiration Date as VarExpDateNum and the current date as VarTodaysDateNum both as variable type - Number. I was able to store the difference between the two in a variable as (VarExpDateNum - VarTodaysDateNum = VarExp-TodayNum) and use it on the condition. 


 


14 weeks in seconds was 1209600 seconds, so my condition looked like this: 



Hope this can help someone! 


 

Reply