AutoSys Workload Automation

  • 1.  javascript - create a variable

    Posted Oct 25, 2018 02:59 PM

    Hello,

     

    I have an espresso application that reads a file and creates as output four variables (concept, corpcode, server, tz).

     

    I now have a requirement to create another variable named "clientname" based on the first 8 characters of the value in the "Server" variable. 

     

    I'm thinking I can easily do this with the slice method similar to what I highlighted in blue below. Does anyone know if this will work? Or have a suggestion on how I can do this?

     

    Below is a one line sample of the data file (there are thousands of lines). Also below is the working javascript with the proposed slice method solution added (in blue).

     

    Sample Input data: Server=nnnnnnnSR01; Concept=nn; Corpcode=nnn; TZ=EASTERN

     

    Espresso

    var RIDFILE = APPL._filename;
    var RID=new java.util.Properties();
    RID.load(new java.io.FileInputStream(RIDFILE));
       APPL.CONCEPT=RID.getProperty('Concept') + '';
       APPL.CORPCODE=RID.getProperty('Corpcode') + '';
       APPL.RESTSERVER=RID.getProperty('Server') + '';
       APPL.clientname=RID.slice(7,8);
       APPL.TZ=RID.getProperty('TZ') + '';

     

    As always any input is greatly appreciated.

     

    Ken Chrapczynski



  • 2.  Re: javascript - create a variable
    Best Answer

    Posted Oct 26, 2018 10:40 AM

    I used a substring of APPL.RESTSERVER to get the result I was looking for.

     

    APPL.CLIENTNAME = APPL.RESTSERVER.substr(0,8);