Automic Workload Automation

Expand all | Collapse all

How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

  • 1.  How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 13, 2018 03:42 PM

    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 ?



  • 2.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 13, 2018 07:40 PM

    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



  • 3.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 14, 2018 08:58 AM

    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:

    • Define roll keywords (or whatever type is most applciable) for the 1st, 2nd, 3rd, 4th, 5th, and 6th day of the month.  (Since you've already come up with a keyword for the 7th, these should be relatively similar.)
    • Define a new group keyword that runs every day except on the 1st, 2nd, 3rd, 4th, 5th, and 6th (and whatever other non-business days apply).


  • 4.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 14, 2018 12:07 PM

    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.



  • 5.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 14, 2018 01:10 PM

    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



  • 6.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 17, 2018 03:39 AM

    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.



  • 7.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 17, 2018 10:31 AM
      |   view attached

    Hi,

     

    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.

     

     

     

    Kind Regards,

    Jeff Enk



  • 8.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 17, 2018 11:40 AM

    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:

    1. Build an 'all days' weekly keyword (select all seven days)
    2. Build a 'weekends' weekly keyword (select Sun & Sat)
    3. Build a 'holidays' group keyword, grouping all of your applicable holiday keywords together (which are presumably defined elsewhere).  Note that these should be your *observed* holidays, if applicable.
    4. Build a 'business days' group calendar that consists of your 'all days' keyword, but excludes your 'weekends' and 'holidays' keywords.
    5. Build a 'non-business days' group keyword that consists of your 'all days' keyword, but excludes your 'business days' keyword
    6. Build a 'first day of month' monthly keyword (select '1' only)
    7. Build a 'first bus day of month' roll keyword.  Source calendar/keyword should reference your 'first day of month' keyword. On the if collisions tab, if the day falls on 'non-business days', then increment by +1 using days from your 'business days' keyword.
    8. Build a 'second bus day of month' roll keyword.  Source keyword is 'first bus day of month'; roll by +1 using days from your 'business days' keyword.
    9. Repeat step 8 to create 'third bus day of month' through 'seventh day of month' roll keywords.  Increase the increment from +2 (3rd bus day) to +6 (7th bus day) for each.
    10. Build a 'seventh bus day to LDM' group keyword that consists of your 'bus days' keyword, but excludes your seven '<***> bus day of month' keywords.

     

    A lot of setup, but it'll be reliable and won't have your problems with weekends.



  • 9.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 18, 2018 10:06 AM

    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.

     

     

     

    Kind Regards,

    Jeff Enk



  • 10.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 18, 2018 06:06 PM

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



  • 11.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 19, 2018 02:34 AM

    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,

    Wolfgang

     

    PS: Nevertheless this reqeust saved me from watching 3 Episodes Greys Anatomy and 2 episodes This is us with my wife :-P



  • 12.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 19, 2018 01:53 PM
      |   view attached

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

     

    Regards

    Jan

    Attachment(s)

    zip
    cale_7th_day.xml.zip   1 KB 1 version


  • 13.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 19, 2018 03:04 PM

    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.

     

     

     

     

     

    Kind Regards,

    Jeff Enk



  • 14.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 19, 2018 03:16 PM



  • 15.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Sep 20, 2018 03:13 AM

    Hi Jeff,

     

    I have excluded also the 7th working day in my example, if that day should be included, then of course it needs an adjustment and I used the german working days, so you need to adjust that too accordingly.

     

    Regards

    Jan



  • 16.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).
    Best Answer

    Posted Oct 12, 2018 04:01 PM

    Hi JeffEnk82305470,

     

    Were you able to get the calendar to work like how you wanted from Jan example after you alter it to (not) use the German working days or if Pete, Daryl, Franz or Wolfgang suggestion was helpful in providing you a direction to go forward with.   If your original question has been answered can you help us use the "Mark Correct" button on the comment that helped your question.  Or let us know if you are still looking for a way to accomplished this.



  • 17.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Oct 12, 2018 04:13 PM

    Thanks to everyone for your help.   It was not easy but thanks to everyone's suggestions my question was answered.



  • 18.  Re: How can I build a non-static calendar to run the 7th working day to the LDM(last day of month).

    Posted Dec 12, 2018 10:02 PM

    Yes my question was answered.  thank you so much.  I want to give a BIG props to this UC4 community, they have helped me so much.  Big THANKS.  I hope I can return the favor....