Skip to main content

Good Morning!

I have a site workflow where I'm trying to compare two dates (both workflow variables). Here is variable 1

26187i2078A688BDC92B9B.png

 

from logging, this evaluates to 10/25/2021 12:00AM.

 

My second date is from a list query:

26188iA65F5A18CAD89292.png

 

this is also logging at 10/15/2021.

 

Here is my Run If

26189i21C9EB71127C7559.png

 and for sanity i'm doing a dateDiff on the side

26190i137E2D291B46D7B1.png

 

The result is 0. So these dates are definitely the same. Why isn't the Run if tripping?   I guess I could do a Run If the dateDiff is 0, but I was previously told by nintex not to have numerous dateDiffs execute on a workflow run because it will cause problems. This set of logic is within a loop that will definitely execute numerous times. What should I do?

Hi @nderiley 



 



Your logic seems solid.



 



To temporarily assist with code debugging



- Replace the RUN-IF with a Conditional Branch



- Display both values before the Conditional Branch



- Display which Branch was taken





 



If the NO Branch is taken, there must be something wrong with one of the values.



Most common is incorrect assignment or assign to a different variable



Perhaps its not a DateType type value - Value is Text-type?



 



 


Try converting the first date that includes the time to a compatible format the FormatDate inline function in a Set Variable actions.  Follow these steps:



 





  1. Add a Set Variable action right after the action where you set the 30days variable.


  2. Configure the Set Variable action



    1. Create a new Text variable (ex. txt30Days) and select it in the Set dropdown.


    2. Keep "Equals Value".


    3. Click on the Insert Reference value to the right.


    4. Go to the Inline Functions tab.


    5. Select the FormatDate function to start configuring the "Dynamic text to insert.


    6. Configure the FormatDate function as: fn-FormatDate(dt30days,"M/d/yyyy")


    7. This will format your date as 10/15/2021.






  3. You might have to create another Text variable and format it with these same steps for the second date to use in your date comparison action.





This works, but the format I have to use is MM/dd/yyyy

Great! Here's a good blog post about formatting date/time strings: https://community.nintex.com/t5/Community-blogs/Date-and-Time-Format-Strings-Quick-Reference-Guide/ba-p/81050 


Reply