Automic Workload Automation

 View Only
Expand all | Collapse all

UC4 scripting

  • 1.  UC4 scripting

    Posted Feb 04, 2020 08:19 AM
    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 Feb 05, 2020 12:10 AM
    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 Feb 05, 2020 05:17 AM
    Hi Pete,

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


  • 4.  RE: UC4 scripting

    Posted Feb 05, 2020 09:09 AM
    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 Feb 05, 2020 10:50 AM
    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 Feb 05, 2020 01:26 PM
    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 Feb 05, 2020 04:31 PM
    Edited by Pete Wirfs Feb 05, 2020 05:11 PM
    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 Feb 06, 2020 03:45 AM
    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 May 04, 2020 11:29 AM
    Hi Christian,

    Kindly help me how to set the last day of previous month

    Thanks
    Praveena Bingi



  • 10.  RE: UC4 scripting

    Posted May 04, 2020 11:37 AM
    Hello.

    I answered this very question that you posted in a separate thread also, while you were posting it again in here.

    I'm sorry, but this is against basic Internet forum etiquette and frankly makes me question why one even bothers.

    Regards.



  • 11.  RE: UC4 scripting

    Posted May 05, 2020 02:21 AM
    Hi,
    you can do it like this

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


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



  • 12.  RE: UC4 scripting

    Posted May 05, 2020 04:48 AM
    Thank u much christian :)


  • 13.  RE: UC4 scripting

    Posted Feb 06, 2020 03:45 AM
    Thank u Much Christoph :)


  • 14.  RE: UC4 scripting

    Posted Feb 06, 2020 06:00 AM
    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
    ----------------------------------------------------------------
    ------------------------------