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

Comparing two dates

Jump to solution

Hi,

I created the following workflow. I am trying to compare today's date with 25 (of the month) If today's date = 25th then run the emailer. I am stuck at defining variable. I was able to define 'DDate = 25'. However, I could not assign 'ToDate' as today's date.

Also in run if, I understand I cannot compare 'Todate' (07.04.2017) with 'DDate' (25). How do I extract the day portion of today's date only?

Thanks! 

Kindly let me know what I am doing wrong.

Reply
12 Replies
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

You could add a column to your list and calculate the DATE() of your date. 

Suppose you column name is birthDate and a value is 25/12/2000, and you create a column named birthDate_DATE ( calculated DATE(birthDate)) , the value will be 25.

You could use birthDate_DATE in your workflow.

Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

Hi,

Thank you for your suggestion. I've created a column called 'Day_Only' in my list and that displays the day of the month.

The workflow is running and stuck there as status 'started'. The error I am getting when I click on workflow status is this 'The field 'Day_x0020_Only' of type 'Calculated' cannot be used in the query filter expression '

The Day_Only calculates to 5 on the list-view and there is only 1 item on list.

PS: I created a new column called 'Next Day' as a static value holding column. Assigned it number 5. Then pulled this into workflow and it worked. The workflow seems to have issues with 'calculated' fields (unless I am doing something wrong).

Is there any other ways to calculate the 'day' portion of the current date within the workflow? This would be helpful for me in designing future workflows which has to  be triggered if the current date = due date (of a list item)/etc.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

Hi Shanan,

Follow the below steps:

1. Create a date type variable and set "Blank" for default date.

2. Create a single line text variable.

3. Create a Number type variable.

4. Insert workflow action, Set Variable , assign date variable with "use date when action is executed"

5. Insert another workflow action, Set Variable, assign text variable with "fn-FormatDate(datevariable, "dd")

6. Insert "Convert Value" workflow action, and convert "text variable" to "number variable"

7. Insert Run If action, check if "number variable is "x number"

8. Then send email.

Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

Thanks!

I am getting an error 'Input string was not in a correct format'. Below are some screenshots from inside the actions

Any help is much appreciated!

Converting text to number below

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

Hi,

Better keep a log and display the value in DataType and TextType variables before the each wrokflow actions, and see if the variables have correct values.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

Thanks. I did that and here is the result before going into 'convert value' box (and after defining values)

TextValue (should this show the formula considering it is logging after the formula?)

fn-FormatDate(7/7/2017 3:12:26 PM,"dd")

DateValue

7/7/2017 3:12:26 PM

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

So, what is the output value for TextVariable when you assign it with fn-FormatDate(7/7/2017 3:12:26 PM,"dd")?

It supposed to return "7" (in text variable).

Then convert this "7" (text variable) to number.

It should work.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

Hi,

The first log-history, I put in '{Variable:TextType}' as description. Second one same thing - I got the following results respectively. In one of the above screen caps I have shown the formula as written.

Could this be caused by the time attached to the date?

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Comparing two dates

Jump to solution

No, it can not be an issue, I see the time portion appended to date in my workflow too.

I am using On-Premises Nintex workflows, and yours is Office 365 Nintex. There should not be any problem with date functions as per my knowledge.

Can you give a try by hard coding the date value in FormatDate() function? like, fn-FormatDate("7/7/2017","dd")

and replace double quotes with single quotes if the above not worked. 

0 Kudos
Reply