Automic Workload Automation

Expand all | Collapse all

read and modify data from a Calendar Keyword from a script

Jump to Best Answer
  • 1.  read and modify data from a Calendar Keyword from a script

    Posted 10-24-2018 09:25 AM

    I intend to read the value highlighted in green from the picture below into a variable. Is there a scirpt function or a way to read and further to change it automatically?

     

    Would it be this possible using some script function? In ideea that I can identify it in the database I presume that is not recommended. Other option I think would be to export it, change it and then import it back.

     

    Thank you!

     

    PS: Automic Workload Automation v12



  • 2.  Re: read and modify data from a Calendar Keyword from a script

    Posted 10-24-2018 12:59 PM

    Now I'm curious.... I can't think of a use-case that would cause me to want to dynamically alter a calendar rule?  And even if you did, every time you did so the calendar object would have to be re-calculated, which can cause interruption of service?

     

    If you tell us why you want to do this, we might be able to offer a better solution?



  • 3.  Re: read and modify data from a Calendar Keyword from a script

    Posted 10-25-2018 01:46 AM

    Thank you for reply Pete!

    We have for one customer a series of workflows scheduled to run in several working days in month. Diffrent WFs will be run like: some on 3rd, some on 4rth, some on 7th and some on 15th working day based on some closing dates. When business is changing the last day for closing activities (+/- 1 day) we have to change in calendar for each of this WFs the keyword. For example if the bussiness postopnes the closing day with one day, we have to edit the calendar for each job into 4th, 5th, 8th and 16th working day; then next month we need to bring them back and so on. One solution will be to put all this WFs in a separate calendar and revert the changes. But I though that will be a more elegant solution using a D+xWD where D will be a parameter.



  • 4.  Re: read and modify data from a Calendar Keyword from a script

    Posted 10-25-2018 03:55 AM

    Hi

     

    I see 2 possible attempts here:

     

    Plan A)
    using your Calendar as template or basic Calendar and calculate an "offset" (given by business) - so every cale entry of your
    template is checked and some days added or substracted and this is used for the objects.

     

    Plan B)
    using your Calendar as template or basic Calendar you create a static calendar (other way round is not possible via script) for every run of your workflows etc. via script.

     

    there are plenty of script functions for calendar calc use:
    https://docs.automic.com/documentation/webhelp/english/AWA/11.2/AE/11.2/All%20Guides/help.htm#uczacs.htm%3FTocPath%3DAutomation%2520Engine%2520Script%2520Guide%7COrdered%2520by%2520Function%7CDate%2520and%2520Time%7C_____0

     

    and honestly: there are plenty of limitations using them :-)

     


    cheers, Wolfgang



  • 5.  Re: read and modify data from a Calendar Keyword from a script

    Posted 10-25-2018 01:29 PM

    We have a similar requirement and solved it with a static keyword that dynamically shifts other keywords.

     

    (1) set up a static keyword called "closing.date" that will have to be manually maintained.

    (2) Set up new keywords that will trigger your tasks;

         "closing.date.minus.five.workdays"

         "closing.date.minus.seven.workdays"

         "closing.date.minus.eight.workdays"

     

    I probably don't have the details right for your use-case, but it shows you the technique that might work for you.



  • 6.  Re: read and modify data from a Calendar Keyword from a script

    Posted 10-25-2018 01:30 PM

    By the way, this is what Wolfgang called "PLAN A". 



  • 7.  Re: read and modify data from a Calendar Keyword from a script
    Best Answer

    Posted 11-30-2018 10:49 AM

    I've build a series of keywords and solved the problem.

    Here is the solution that I've implemented:

     

    A weekly keyword in order to get all the days except weekends:

     

    A Group keyword in order to take out the free days(like holidays) and obtain only the office days:

     

    A Monthly keyword for the 1st day from the month:

     

    A Roll keyword in order to get the 1st working day to raport to it:

     

    Another Roll keyword that will be used to add the delayed number of days:

    For example if I need to postpone the executions days with two days, I will adjust it to +2

     

    The keyword used to schedule jobs on the 3rd working day is:

     

    and the result is :

     

    If the closing dates are postopned with 2 days, then from D keyword adjusting it with 2 (+2) the result will be:

     

    Thank you Pete and Wolfgang for your support!



  • 8.  Re: read and modify data from a Calendar Keyword from a script

    Posted 11-30-2018 10:53 AM

    Is obvious that the change need to be performed manually, but still is only one place. Still I will think of a solution where the D keyword adjust valuea to be made from a script. I'll come back later with that solution