ESP dSeries Workload Automation

 View Only
Expand all | Collapse all

Generate a date variable based off of two different requirements

  • 1.  Generate a date variable based off of two different requirements

    Posted Oct 07, 2022 01:28 PM
    Hello my javascripting guru's.

    Can someone share how they would create two YEAR variables, then use them in an IF/ELSE statement to create a single variable? Or recommend a simpler way to create a variable to resolve this requirement?

    Here are the requirements:
    If the run is for the last Thursday of March or June, use the Year (2022).
    If the run is for the last Thursday of Sept or Dec, use the Year + 1 (2023).

    Thank,
    Ken Ski

    ------------------------------
    DARDEN Corporation
    Orlando, FL
    ------------------------------


  • 2.  RE: Generate a date variable based off of two different requirements

    Broadcom Employee
    Posted Oct 10, 2022 07:24 AM
    Hi,

    Not sure if I understood the requirement correctly , so based on the job run for the 2 options above , do you want to set any variable . If so , can you please use the following example

    if (today('last workday of March') || today('last workday of June'))
    WOB.year = "2022";

    if (today('last workday of September') || today('last workday of December'))
    WOB.year = "2023";

    Syntax -

    https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/ca-workload-automation-de/12-3/scheduling/using-javascript/built-in-functions/calendar-javascript-functions.html#concept.dita_0b29fe727de3798e6f8f3ba51e892612c21ff2f1_today

    Hope it helps!
    Ravi Kiran