I have a Roll calendar to get the 7th working day of month(Sept 11, 2018, Oct 9th, 2018, nov th etc..) and I have a calendar for LDM. How how can I create a calendar to run on days from 7th working day to LDM ?
Boy, I'm having a hard time solving this one. One alternative to consider, is to run it every day with this process script in a workflow that contains the desired processes. This process script decides to either let the workflow run its tasks, or skip them with the "stop nomsg" command (you'll have to change the calendar object name and the calendar keyword name);
!Retrieve the 7th WDAY of the month out of our calendar object:set &FirstOfMonth# = "&$PHYS_DATE_YYYY#&$PHYS_DATE_MM#01":set &SEVENTHWDAY# = add_days("YYYYMMDD:&FirstOfMonth#",0,"CALE.SAIF","7TH.WDAY.OF.MONTH"):print "7th WDAY : &SEVENTHWDAY#"
!Decide if we should execute today or not:if &$PHYS_DATE_YYYYMMDD# < &SEVENTHWDAY#: print "WORKFLOW IS NOT SUPPOSED TO RUN TODAY": stop NOMSG :else: print "TODAY IS ON OR AFTER &SEVENTHWDAY#, TIME TO RUN":endif
I agree that this one sounds like a bit of a doozy.
I think there's probably a more elegant way to do this, but this should work, too:
I thought about that idea, but I wasn't ready to assume that it is supposed to only run on workdays. If it is only going to run on workdays, then I prefer your idea of defining the first 6 workdays and tell it to run on workdays except for those workdays. That should be easy to do.
This job should run everyday including weekends from 7th working day to LDM.. The 7th working day of the month changes which is the problem I'm having. I was hoping to build a calendar as I'm not that familiar with scripting. I will try the script from the previous suggestion and see what happens. Thx
How to think reverse? You can use don't run a calendar keyword as well.What does it mean:I would set a automatic calendar for first 7 workdays of month. Than I would use don't run if this new created calendar keyword for example "1st7wd_month" is valid, instead using run on a more complex calendar value to build with script.
I think it’s more complicate then what you say. I can set a group calendar to include 1st thru 7th working days but I have a problem including weekends in between the 1st and 7th.
One Saturday and Sunday will always fall between the 1st and 7th working days, but it get tricky for the second Saturday or Sunday of the month. If I include the second Sat or Sun of month then it gets messed up on Oct.
If weekends are causing a problem with your '1st-thru-7th working day calendar', then I think there's a problem with that definition you're using.
Here's how I would approach it. You'll need a bunch of base keywords to start with:
A lot of setup, but it'll be reliable and won't have your problems with weekends.
Close but no cigar. I need to run these jobs after the 7th working day to LDM (including weekends). If I include weekends I get the calendar below but I do not want to run any days between the 1st to the 7th working day of month.
If I use this group for only business days, then the weekends are not included after the 7th working day. I need calendar for 7th working day to LDM including weekends.
I’m beginning to think it may not be possible using calendars.
I agree that this can not be solved using calendars. You want a workday-rule to trigger a dayofmonth-run-cycle. These are apples and oranges.
I hope you find my script idea to be useful...
Honestly I have to admit I gave up after 4 hours.
my "final breakdown" was differing between the first weekend in month that should not be coverend and the second weekend in month that shuld sometimes be covered -depending on the 7th workday and the restof the weekends that should be covered.
The one last hint that comes to my mind is creating several CALE objects that fit your needs together and combine them - e.g. in the Task settings in a workflow: "Execute when all Conditions match"
cheers & sry,
PS: Nevertheless this reqeust saved me from watching 3 Episodes Greys Anatomy and 2 episodes This is us with my wife :-P
I think, I got a working solution.
The approach of Daryl is a good start, but I needed to add some more specific calendar keywords to got it to work (a total of 14):
- first of all, a keyword 1st to 9th day of month needs to be created, because the 7th workday cant occur earlier then the 9th day of a month (assuming, that you count only Monday to Friday as working days), so we get rid of the first 9 days - 1ST_TO_9TH_MONTH
- then you need the 6th and 7th workday as keywords - 6TH_WD and 7TH_WD
- these needs to be duplicated with the logic of "if the 6th and 7th working day occurs on Monday, also the weekend before needs to be removed" 6TH_WD_PREVSAT, 6TH_WD_PREVSUN, 7TH_WD_PREVSAT, 7TH_WD_PREVSUN
- the next problem is the 10th day of month, as it can be, that it falls to a holiday and then the 7th is moved to the next day (11th day) => so I created a keyword which takes care of that 10TH_HOLIDAY
- now I've finally combined all the keyword into a offset keyword 7WD_TO_EOM
I've also exported the calendar object and attached if you want to have a look on it (I used the German holidays to get the working day list, so it probably need some adjustments).
I looked at the file you attached and it does not look correct. Below is the STATIC calendar I created to accomplish 7WD_TO_LDM (aka U7_TO_LDM)
Your examples do not match my STATIC calendar.
Retrieving data ...