hiteksoftware.com Forum Index hiteksoftware.com
User discussion forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Business date variables

 
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Variables and Regular Expressions
View previous topic :: View next topic  
Author Message
VincentMagnotta



Joined: 28 Jul 2008
Posts: 46

PostPosted: Mon Jul 28, 2008 3:53 pm    Post subject: Business date variables Reply with quote

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:


  1. Base Case
    Given the date Tuesday 7/29/2008, previous date is 7/28/2008. DATEADD/DATEADDX already does this case.

  2. 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.

  3. 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
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 595
Location: Santa Barbara, california

PostPosted: Mon Jul 28, 2008 9:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
melvin
Site Admin


Joined: 25 May 2006
Posts: 595
Location: Santa Barbara, california

PostPosted: Mon Jul 28, 2008 9:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
VincentMagnotta



Joined: 28 Jul 2008
Posts: 46

PostPosted: Mon Jul 28, 2008 10:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 595
Location: Santa Barbara, california

PostPosted: Tue Jul 29, 2008 7:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
VincentMagnotta



Joined: 28 Jul 2008
Posts: 46

PostPosted: Tue Jul 29, 2008 7:57 am    Post subject: Reply with quote

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
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Tue Jul 29, 2008 10:33 am    Post subject: Reply with quote

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
View user's profile Send private message
VincentMagnotta



Joined: 28 Jul 2008
Posts: 46

PostPosted: Tue Jul 29, 2008 10:38 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Variables and Regular Expressions All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group