Automic Workload Automation

Expand all | Collapse all

UC4 scripting

Jump to Best Answer
  • 1.  UC4 scripting

    Posted 20 days ago
    hello all,
    I'm very new to this tool
    I need help in scripting in one automic.
    I have a requirement to set the posting date to last day in month in the variant .
    I need help to write the script so that the posting date would set to last day in a month dynamically
    Kindly suggest on this.

    Thanks
    Praveena Bingi


  • 2.  RE: UC4 scripting

    Posted 19 days ago
    Does this need to be done in a script, or does this need to be done as a default value in a promptset?

    ------------------------------
    Pete
    ------------------------------



  • 3.  RE: UC4 scripting

    Posted 19 days ago
    Hi Pete,

    its needs to be done in  a script so that it fetches the value dynamically


  • 4.  RE: UC4 scripting

    Posted 19 days ago
    Hi Praveena,

    here you go (see screen shot):

    1. create a CALE. Create a Monthly event like displayed
    2. run this script in any object:

    :set &current_date# = sys_date()
    :set &ld# = CALE_LOOK_AHEAD(&current_date#,"ONE","CALE.LAST_DAY_OF_MONTH","LAST_DAY_OF_MONTH")
    :print &ld#

    Cheers
    Christoph







    ------------------------------
    ----------------------------------------------------------------
    Automic AE Consultant and Trainer since 2000
    ----------------------------------------------------------------
    ------------------------------



  • 5.  RE: UC4 scripting
    Best Answer

    Posted 19 days ago
    Hi Praveena,

    you can also do it like this

    :set &date# = LAST_OF_PERIOD("YYYYMMDD:&$PHYS_DATE_YYYYMMDD#","MM","YYYYMMDD")
    :print last day of month = &date#


    ------------------------------
    Thx & rgds
    Christian
    ------------------------------



  • 6.  RE: UC4 scripting

    Posted 19 days ago
    That's much better than my approach!

    But: if you need to determine the - let's say - last work day of a month - my approach wins ;-)

    Cheers
    Christoph



    ------------------------------
    ----------------------------------------------------------------
    Automic AE Consultant and Trainer since 2000
    ----------------------------------------------------------------
    ------------------------------



  • 7.  RE: UC4 scripting

    Posted 19 days ago
    Edited by Pete Wirfs 19 days ago
    Kind of going off the rails here, but...

    We sometimes need to return relative dates from an Oracle database because our Oracle DBAs have set it up so our developers can change the 'system date' that is returned.  This allows them to do more robust testing against month-end processing, etc.  So we've got a bunch of VARA objects with SQL in them to return various dates.  We can also resolve workday formulas by virtue of having our own holiday table in our Oracle systems.

    Where this type of testing falls apart, is when UC4 Calendar rules come into play.  The testers have to manipulate these types of tests manually.

    ------------------------------
    Pete
    ------------------------------



  • 8.  RE: UC4 scripting

    Posted 18 days ago
    Thanks a lot  Christian.Its working fine
    I have one more doubt, i have a periodic job which runs every 6 minutes. i need to set the condition like until n unless 1st run the finishes successfully, the next run of the job shouldnt trigger. Could you please help me in this regards


  • 9.  RE: UC4 scripting

    Posted 18 days ago
    Thank u Much Christoph :)


  • 10.  RE: UC4 scripting

    Posted 18 days ago
    Maybe ist worth mentioning that CALE_LOOK_AHEAD by default only checks for the next 14 days. That can be changed in UC_CLIENT_SETTINGS => CALE_LOOK_AHEAD_MAX => xx (days). Be carefull with the number of days, as this value is also relevant when the server checks calendar conditions for objects within a JSCH. A large value can influence the system performance. One shouldn't thoughtlessly set the value in the UC_CLIENT_SETTINGS of client Zero.

    LAST_OF_PERIOD is not influenced by CALE_LOOK_AHEAD_MAX

    Christoph

    ------------------------------
    ----------------------------------------------------------------
    Automic AE Consultant and Trainer since 2000
    ----------------------------------------------------------------
    ------------------------------