You are viewing limited content. For full access, please sign in.

Question

Question

Compare Dates in Workflow?

asked on June 8, 2016

I am making a workflow that is supposed to compare dates to find the largest out of a search. I changed the token to be treated as a date rather than a string but it is still not working correctly. 

 

 

0 0

Answer

SELECTED ANSWER
replied on June 13, 2016 Show version history

Where do the values in For Each Value come from?

For Each Value always sets its tokens as string, so the entire conditions evaluates as string. You can use an Assign Tokens inside For Each Value to set them as dates, and then use the newly created token in the condition instead of For Each Value's current value.

1 0

Replies

replied on June 8, 2016

Can you add a screenshot of how the condition was evaluated at run time (from the Conditions tab in the instance details)?

0 0
replied on June 8, 2016

As you can see here the condition is evaluating incorrectly. 

[False] If all these conditions are true:

              [False] Entry Token (ForEachValue_Current Value) '2/2/2015 (is greater than) '7/18/2014'

 

0 0
replied on June 8, 2016 Show version history

This one evaluated incorrectly

 

 

 

 

0 0
replied on June 8, 2016

This one did evaluate correctly. The token starts at 01/01/1900

0 0
replied on June 8, 2016

Looks like they're evaluating as strings. Did you start a new instance after changing the token type to date or did you just use the running one? Token types won't update after the token has been generated.

0 0
replied on June 8, 2016

Yes. I republished and created a new test document which triggers the workflow. Im thinking I may need to remove the tokens and add them back into the workflow to refresh it. Will update here. 

0 0
replied on June 13, 2016

I removed all the tokens and saved then added them back in but that still didnt work. I also recreated the workflow and the tokens are still not evaluating correctly.

Do we need to break it apart so it evaluates the year first and then the month and day? 


Workflow server is 9.2.0.167. 

 

0 0
SELECTED ANSWER
replied on June 13, 2016 Show version history

Where do the values in For Each Value come from?

For Each Value always sets its tokens as string, so the entire conditions evaluates as string. You can use an Assign Tokens inside For Each Value to set them as dates, and then use the newly created token in the condition instead of For Each Value's current value.

1 0
replied on June 14, 2016

Thanks that is very helpful to know for the future. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.