| View previous topic :: View next topic |
| Author |
Message |
VincentMagnotta
Joined: 28 Jul 2008 Posts: 46
|
Posted: Mon Jul 28, 2008 3:53 pm Post subject: Business date variables |
|
|
I need to be able to determine the previous business day. I have no issue writing code to do so, it just seems that given Automize can create almost every date I need I wonder how I'd go about the following:
- Base Case
Given the date Tuesday 7/29/2008, previous date is 7/28/2008. DATEADD/DATEADDX already does this case.
- Simple case
Given the date Monday 7/28/2008, the previous business day is Friday 7/25/2008. Not sure the best way to do this in Automize.
- Really messy case
Given the date Monday 7/7/2008, the previous day is Thursday 7/3/2008. I understand that this one is hard to do.
Any idea how to do anything beyond the Base case? |
|
| Back to top |
|
 |
melvin Site Admin
Joined: 25 May 2006 Posts: 595 Location: Santa Barbara, california
|
Posted: Mon Jul 28, 2008 9:42 pm Post subject: |
|
|
Simple case
Given the date Monday 7/28/2008, the previous business day is Friday 7/25/2008. Not sure the best way to do this in Automize.
DATEADDX should work here too (use -3) |
|
| Back to top |
|
 |
melvin Site Admin
Joined: 25 May 2006 Posts: 595 Location: Santa Barbara, california
|
Posted: Mon Jul 28, 2008 9:44 pm Post subject: |
|
|
Really messy case
Given the date Monday 7/7/2008, the previous day is Thursday 7/3/2008. I understand that this one is hard to do.
yes, this is hard. gotta think this one and get back to you |
|
| Back to top |
|
 |
VincentMagnotta
Joined: 28 Jul 2008 Posts: 46
|
Posted: Mon Jul 28, 2008 10:08 pm Post subject: |
|
|
| Actually -3 doesn't help me. I need to automatically remove the right amount of days. If it's thursday, give me wednesday, if it's monday, give me friday. Is there a way to handle that choice inline? |
|
| Back to top |
|
 |
melvin Site Admin
Joined: 25 May 2006 Posts: 595 Location: Santa Barbara, california
|
Posted: Tue Jul 29, 2008 7:52 am Post subject: |
|
|
For friday you do a separate schedule (mondays only) and -3.
For monday through thursday you do another schedule (tuesday - friday) and -1. |
|
| Back to top |
|
 |
VincentMagnotta
Joined: 28 Jul 2008 Posts: 46
|
Posted: Tue Jul 29, 2008 7:57 am Post subject: |
|
|
The issue is not scheduling, though that's a useful tip. The issue is filenames. We process the files for the previous business day and output it to filename of the form MyFile.MMDDYYYY.zip where the date is the previous business day. So, I'd have to have two schedules for each chain with two sets of tasks just to deal with the date of the filename?
Instead, is this something I could do with a Script task?
Thanks for the quick responses, I appreciate it! |
|
| Back to top |
|
 |
Robert Site Admin
Joined: 25 May 2006 Posts: 1140
|
Posted: Tue Jul 29, 2008 10:33 am Post subject: |
|
|
in this case, you could use a variable monitor task within the chain.
The variable monitor could check for the day of the week variable (dw).
See help on DATE variable (dw) . SUNDAY = 1 in the US (Country dependent).
If dw = 2 , run task with -3, if otherwise skip to task with -1
this way, you could use one schedule, one chain with two tasks for the filename format. |
|
| Back to top |
|
 |
VincentMagnotta
Joined: 28 Jul 2008 Posts: 46
|
Posted: Tue Jul 29, 2008 10:38 am Post subject: |
|
|
| Hmm, apparently I need to explore the variable monitor more, it looks like it can do a lot of the basic decision making for various processes inline. Thanks again. |
|
| Back to top |
|
 |
|