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

Question

Question

Workflow to determine which decade date falls under

asked on September 2, 2015

Good Afternoon, 

 

Currently i have a workflow that retrieves the date value from a template and pattern matches the full year \d\d\d\d so that i can save the token as the YEAR. 

 

I'm trying to determine how i would be able to determine how i can use that date and move an entry to its appropriate decade folder. 

 

For Example

 

Root Folder

     2013

     2012

     2000-2011

 

So if the document date entry is 12/30/2013 it goes into the 2013 folder

but if the document date entry is 1/20/2005 it should go into the 2000-2011 folder. 

0 0

Answer

SELECTED ANSWER
replied on September 2, 2015

You could use a Conditional Decision to evaluate the YEAR token to determine the decade. This would require a branch for each decade folder and 2 conditions. Using your example, YEAR>=2000 AND YEAR<2011. Inside each branch you can hard code the relevant decade folder in your Move Entry activity.

 

You will have to be careful with your conditions to make sure you handle your edge cases properly.

 

After you have defined all the decade folders you can define another branch that will catch any years that fall outside your decade folders. In this branch you can use the Move Entry activity and use the YEAR token in the Path to sort into the correct year folder. Using your example the path would be "\ROOT\YEAR\".

 

This way you only need to modify the Workflow when you wish to define a new decade folder.

 

Hope this helps.

3 0

Replies

replied on September 2, 2015

If we're really talking about decades, you can use a mix of regular expression and formatting to get the decade number. For ex, %(Date#"yyyy"##<\d\d(\d)\d>#) will return "1" from a date like 9/2/2015. You can then set the path to use "20%(Date#"yyyy"##<\d\d(\d)\d>#)0 - 20%(Date#"yyyy"##<\d\d(\d)\d>#)9" which would give you 2010-2019.

In your case, you have a custom interval like 2000 to 2011, then 2012 and 2013 as separate years. So Adam's solution above is the way to go. Or you could use a table that has the date ranges and look up which one you fall in.

2 0
replied on September 2, 2015

Actually i got it to work. 

0 0
replied on September 2, 2015

I ended up going a different route, its not very pretty as it takes a bunch of space but essentially used a conditional decision to pattern match the date and then determine if its between a range, and reassign the token according to the route it took. 

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

Sign in to reply to this post.