Automic Workload Automation

 View Only
  • 1.  How to set the period dynamically

    Posted May 06, 2021 06:45 AM
    Hello  Everyone

    Hope Everyone is safe 

    I need your help in writing a script for a job. Let me explain 

    In our project, the financial year starts from october  and end in september. So the period is 1 for october, 2 for november, 3 for december, 4 for january.... 12 for september

    Our current requirement is P_PERIT field the period  should be financial period  like 8 for current month "MAY" i.e . current calendar month +3 

    and for october the financial period should be 1 instead of calendar month 10 . Kindly help me to write a script




     Kindly help me to write the script for the requirement

    ------------------------------
    Thanks
    Praveena Bingi
    ------------------------------


  • 2.  RE: How to set the period dynamically

    Posted May 06, 2021 12:40 PM
    These do not look like Automic Workload Automation screens to me (aka UC4).  Are you sure you are in the correct forum?

    ------------------------------
    Pete Wirfs
    SAIF Corporation
    Salem Oregon USA
    ------------------------------



  • 3.  RE: How to set the period dynamically

    Posted May 07, 2021 03:03 AM
    Hi Pete,

    Below screens are from SAP  . we schedule our jobs in uc4


  • 4.  RE: How to set the period dynamically

    Posted May 07, 2021 01:33 AM
    There's probably better ways to write this, but it was quick and easy tonight since it is late here. I'm not entirely sure what version you are using, maybe Appworks... again, i am not sure, so I don't know how you update the fields dynamically. I'm also assuming you can run the script on the first day of the month. You can change that fit your needs. The first of period month will give you the month and then format it to just return MM for the month value, then the IF statements can designate your period value depending on the number of the month. Like I said, there are probably better ways to do this, but it's late and it was easy to write quickly. 
     
    :SET &DATE# = SYS_DATE('YYYYMMDD')
    :SET &month# = FIRST_OF_PERIOD("&DATE#","MM","MM")
    :print &month#
    :if &month# = '10'
    : set &period# = '1'
    :endif
    :if &month# = '11'
    : set &period# = '2'
    :endif
    :if &month# = '12'
    : set &period# = '3'
    :endif
    :if &month# = '1'
    : set &period# = '4'
    :endif
    :if &month# = '2'
    : set &period# = '5'
    :endif
    :if &month# = '3'
    : set &period# = '6'
    :endif
    :if &month# = '4'
    : set &period# = '7'
    :endif
    :if &month# = '5'
    : set &period# = '8'
    :endif
    :if &month# = '6'
    : set &period# = '9'
    :endif
    :if &month# = '7'
    : set &period# = '10'
    :endif
    :if &month# = '8'
    : set &period# = '11'
    :endif
    :if &month# = '9'
    : set &period# = '12'
    :endif
    :print &period#

    This returns the following to the job report for the current month of May:

    2021-05-06 23:14:46 - U00020408 05
    2021-05-06 23:14:46 - U00020408 8


    ------------------------------
    Assistant Director of Production Services
    University of Colorado
    Colorado
    ------------------------------



  • 5.  RE: How to set the period dynamically

    Posted May 07, 2021 03:04 AM
    Hi Cristine,

    Let me try this and get back to you


    Thanks
    Praveena Bingi


  • 6.  RE: How to set the period dynamically

    Posted May 07, 2021 04:08 AM
    Hi Christine,

    Thank you for the code. its working fine

    Thanks
    Praveena Bingi


  • 7.  RE: How to set the period dynamically

    Posted May 07, 2021 09:43 AM
    :)