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

Question

Question

date comparison problem (12/24/14>1/5/15?)

asked on January 6, 2015 Show version history

I get the following in the condition breakdown of my workflow. Am I missing something? I don't quite understand how 12/22/14 is NOT less than 1/5/15. It's pulling the last modified of a document date and comparing it to yesterday to see if it's older than yesterday. December 22nd of 2014 is clearly less than January 5th of 2015.

Is Workflow looking at December being greater than January and not looking at the year? If so, how do I fix this?

0 0

Answer

SELECTED ANSWER
replied on January 6, 2015

The default type for tokens is created by Assign Tokens is string. As strings, "1/" sorts alphabetically before "12", which makes 1/5/2015 less than 12/22/2014. You would need to change the tag on the token created by "Last Modified date of shortcut" to date instead of string.

4 0

Replies

replied on January 6, 2015

what version of Workflow are you on? I know at some points conditional activities had trouble evaluating the  statements it was given

0 0
replied on January 6, 2015

Version 9.1.1.365

0 0
replied on January 6, 2015 Show version history

Where does that token come from? What activity is this condition in?

0 0
replied on January 6, 2015

I am looking in a folder and finding each shortcut then for each shortcut, I am pulling the last modified date. Then I am creating a token from Last Modified to drop the time stamp so it is just a date. Then I am comparing the Last Modified token to another Token called Oldest File. If the Last Modified is older than the current oldest file date, then it updates the Oldest File token to find the oldest file in the folder.

(Note Today - 10 days is currently calculating yesterday for testing purposes. In production it will find files older than 10 days old.)

The condition in question is the second to last conditional sequence comparing the current last modified date to the Oldest File token. It found the last modified date of 12/22/14 and is comparing to yesterday 1/5/15 and it's saying that 12/22/14 is NOT less than 1/5/15 so it will not update the oldest token.

Workflow:

 

0 0
replied on January 6, 2015

Can you try tagging the token you're creating as date instead of string? Or use the token generated by For Each Entry instead of reassigning it to your own token?

0 0
replied on January 6, 2015

I tried using the token generated by the For Each just left the time stamp on it - it let me update the oldest token, but when it came to comparing the oldest token to older than Today - 10 days (yesterday for testing/ 1/5/15) it again said that 12/22/14 is NOT less than or equal to 1/5/15.

 

So, I tried to use the token and instead of using a regular expression - I applied formatting (m/d/yy - I think that's what you meant by tagging the token as date instead of string?). That one will not let me update the oldest token because it says that 12/22/14 is NOT less than or equal to 1/5/2015. I've tried a few times with MM/dd/yy and M/d/yy, etc... all with the same results.

 

I checked every date I have in there and formatted ALL to M/d/yyyy and I still get:

0 0
SELECTED ANSWER
replied on January 6, 2015

The default type for tokens is created by Assign Tokens is string. As strings, "1/" sorts alphabetically before "12", which makes 1/5/2015 less than 12/22/2014. You would need to change the tag on the token created by "Last Modified date of shortcut" to date instead of string.

4 0
replied on January 6, 2015

Woo Hoo! Thank you, Miruna. That was it. Sorry, I wasn't familiar with the token tags and did not think to look there. Clearly that was what was going on.

0 0
replied on January 6, 2015

Yeah, that's the usual cause of "my date/number conditions evaluate weirdly". It was just a matter of figuring out where the values were coming from.

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

Sign in to reply to this post.