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

Question

Question

month sorting

asked on September 8, 2015

hi!

i am trying to get a workflow to generate a folder structure that includes the month.

I also need it to display in financial year order (july through june)

This of course is neither alphabetic or numeric sort, so i figure i'll need to prefix the month name such as;

01_july

02_August

the bit that's bothering me is how to take the month (eg,i have  '09' from a pattern match) and turn it into a part of the path (eg '03_September)

Obviously i could have a conditional decision with 12 branches, but there has to be a neater way.

I'd really rather not use an external sql table if i can avoid it.

Any suggestions appreciated

 

Mark

0 0

Replies

replied on September 9, 2015

There's not enough info on where the dates come, but assuming field values, you could do it with just 2 branches. You could extract the month as a number, then check if it's greater or less than 6. Then use Token Calculator to subtract 6 if it's greater and add 6 if it's less. That would give you 1 for July, 2 for August and so on. You could format this value with 2 digits when used in the folder path.

1 0
replied on September 9, 2015

Hi!

That sounds like a good idea.  yes, the date is coming from a date field in the template. This will give me the correct numbering, It still leaves me wanting the month's name.

The date field is currently dd/MM/yyyy. If i change this field to use the full long date field, it has the month's name, but doesn't seem to have the month as a number.

I suppose i could have 2 date fields and hide one from the user intervention.

Trying to keep the wf's neat, but also not too complex for support/troubleshooting. The '12 branch' idea is simpler for troubleshooting etc. I'll have a go using the token calculator and date fields and see how i go. I can always fall back to the '12 branch conditional decision' idea if i cant get it to work.

Thanks,

 

Mark

0 0
replied on September 9, 2015

You can use date formatting to get both the date as a number and as its name from the value. Take a look at the help file for formatting options.

0 0
replied on September 9, 2015

Hi Mark,

 

I think you have pretty much hit the nail on the head. You have outlined both options either 12 branches or an external SQL lookup table.

The other option I suppose could be to have it done in a custom SDK script activity that calculates the input/output and provides the necessary info for the output path. But then you would kind of argue the point in how that is any different to using a SQL table.

Good question but I can't think of any other way either....frown

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

Sign in to reply to this post.