Automic Workload Automation

Expand all | Collapse all

GET_VAR and :FILL

  • 1.  GET_VAR and :FILL

    Posted Jul 22, 2016 10:53 AM
    I am testing using CREATE_PROCESS and PUT_PROCESS_LINE, and I have run into an error when using GET_VAR. Here is the script
    :DEFINE &ProfileList#, string, 4
    :FILL &ProfileList#[] = GET_VAR(UC0.MAL.PROFILE_LIST.VARA)
    :PRINT &ProfileList#[1]
    :PRINT &ProfileList#[2]
    :PRINT &ProfileList#[3]
    :PRINT &ProfileList#[4]
    This results the following error message:
    7/22/2016 15:48:15 -  U00020331 Runtime error in object 'UC0.CREATE_PROCESS_TEST.SCRI', line '00002':
    U00003712 Missing key for accessing variable 'UC0.MAL.PROFILE_LIST.VARA'.
    The GET_VAR tool tip indicates that the second argument is optional:
    xyw10u9qjbg3.png
    The documentation page for PUT_PROCESS_LINE also includes an example using GET_VAR with only one argument:
    :SET &HND# = PREP_PROCESS_FILENAME("WIN01","C:\AUTOMIC\temp\test*.txt","Y",,)
    :SET &LINE# = GET_VAR(VARA.FILELIST)
    :SET &RET# = PUT_PROCESS_LINE(&HND#,&LINE#)
    Is it possible to run GET_VAR with only one argument? If so, how? If not, are the documentation and tool tip incorrect?

    Also, although the GET_VAR documentation indicates that the second argument specifies the name of a VARA key, the tool tip refers to the second argument as the Validity Keyword. This suggest that it is not limited to just the name of a key. What are the other valid values of the Validity Keyword? Moreover, how does one use GET_VAR and :FILL together to fill an array with multiple values?

    FWIW, this is AE v11.2.2.


  • 2.  GET_VAR and :FILL

    Posted Jul 22, 2016 11:53 AM
    I have quite a few implementations of GET_VAR with only one argument.  I'm not sure how it decides which KEY to select, but we only use this format against variables that have only one key and it always returns Value1 for that key.


  • 3.  GET_VAR and :FILL

    Posted Jul 22, 2016 11:58 AM
    <never mind.  I made a comment about your error that was of no value.>


  • 4.  GET_VAR and :FILL

    Posted Jul 22, 2016 12:18 PM
    Pete Wirfs said:
    <never mind.  I made a comment about your error that was of no value.>
    Well, I edited my comment, and your reply referenced something that I removed. I was playing around with other possible values for the Validity Keyword, including ALL. I initially forgot to remove this bit from my original post.


  • 5.  GET_VAR and :FILL

    Posted Jan 09, 2017 05:38 AM
    I learned a bit more about how GET_VAR works. It does not require more than one argument if the VARA object being accessed has only one column. FILELIST VARAs (as in the example shown on the PUT_PROCESS_LINE documentation page) have only one column. In that example though, only the first item in the file list will be inserted into the array. A single-element array is not particularly useful.

    Based on the name of the command, it seems reasonable that it is intended to fill an array with more than one element. That is something that is actually useful. It is possible to use :FILL and GET_VAR, to fill an array with the values of a single VARA row whose key is known.

    Does anyone know a way to use :FILL and GET_VAR to fill an array with the values from a specific VARA column? It’s possible to do this with a few more lines, using :PREP_PROCESS_VAR (and an incrementing counter), but I wonder if there is a simpler way.


  • 6.  GET_VAR and :FILL

    Posted Jan 09, 2017 09:15 AM
    It’s possible to do this with a few more lines, using :PREP_PROCESS_VAR
    Based on your description I created a very simple static VARA with this content:

    rypnnk80q8v7.pnghttps://us.v-cdn.net/5019921/uploads/editor/b2/rypnnk80q8v7.png" width="351">

    and tried with PREP_PROCESS_VAR and :FILL :

    :DEFINE &ProfileList#, string, 4
    :SET &HND# = PREP_PROCESS_VAR (UC0.MAL.PROFILE_LIST.VARA)
    :PROCESS &HND#
    :SET &KEY# = GET_PROCESS_LINE(&HND#, 1)
    :P &KEY#
    :FILL &ProfileList#[] = GET_VAR("UC0.MAL.PROFILE_LIST.VARA", &KEY#,1)
    :ENDPROCESS
    :PRINT &ProfileList#[1]
    :PRINT &ProfileList#[2]
    :PRINT &ProfileList#[3]
    :PRINT &ProfileList#[4]

    It did not work as expected : only the last value retrieved with PREP_PROCESS_VAR was actually used to  fill in the array:

    3s32b0yks8eo.pnghttps://us.v-cdn.net/5019921/uploads/editor/km/3s32b0yks8eo.png" width="332">

    This - not so pretty - piece of code however:

    :DEFINE &ProfileList#, string, 4
    :SET &COUNT# = 1
    :SET &HND# = PREP_PROCESS_VAR (UC0.MAL.PROFILE_LIST.VARA)
    :PROCESS &HND#
    :SET &KEY# = GET_PROCESS_LINE(&HND#, 1)
    :SET &ProfileList#[&COUNT#] = GET_VAR("UC0.MAL.PROFILE_LIST.VARA", &KEY#,1)
    :SET &COUNT# = ADD (&COUNT#, 1)
    :ENDPROCESS

    :PRINT &ProfileList#[1]
    :PRINT &ProfileList#[2]
    :PRINT &ProfileList#[3]
    :PRINT &ProfileList#[4]

    did the job :

    bc6tqgygrz54.pnghttps://us.v-cdn.net/5019921/uploads/editor/3n/bc6tqgygrz54.png" width="378">

    But it did not use :FILL at all...

    Kind regards,
    Antoine




  • 7.  GET_VAR and :FILL

    Posted Jan 09, 2017 09:24 AM
    Antoine Sauteron wrote:
    It’s possible to do this with a few more lines, using :PREP_PROCESS_VAR
    This - not so pretty - piece of code however...did the job. But it did not use :FILL at all.
    Yeah, your solution using a counter is what I was referring to. I have not figured out how to use :FILL for anything really practical. It seems like a good idea, only partially implemented.


  • 8.  GET_VAR and :FILL

    Posted Jan 10, 2017 08:28 AM
    ...
     I have not figured out how to use :FILL for anything really practical. It seems like a good idea, only partially implemented...
    There is a practical use for FILL - to be honest I got this code snippet from a collegue of mine who is heavily using that - its great to cut out  strings within a big string seperated by a seperator - used when working with CSV files.

    Example:

    :SET &STRING# = "Schubiduba;Oleole;Heureka;Auweh;"

    :DEFINE &ARRAY#, string,5
    :FILL &ARRAY#[] = STR_SPLIT(&STRING#,";")


    :SET &ZVAR# =1
    :SET &ZVAR# = FORMAT(&ZVAR#,"00")
    :SET &ARR_LEN# = LENGTH(&ARRAY#[])


    :WHILE &ZVAR# < &ARR_LEN#
    :SET &ZVAR# = FORMAT(&ZVAR#,"00")
    :  PRINT "Element &ZVAR# = &ARRAY#[&ZVAR#]"
    :  SET &ZVAR# = &ZVAR# + 1
    :ENDWHILE


    Report:
    2017-01-10 13:26:50 - U00020408 Element 01 = Schubiduba
    2017-01-10 13:26:50 - U00020408 Element 02 = Oleole
    2017-01-10 13:26:50 - U00020408 Element 03 = Heureka
    2017-01-10 13:26:50 - U00020408 Element 04 = Auweh








  • 9.  GET_VAR and :FILL

    Posted Jan 10, 2017 08:38 AM

    ...
     I have not figured out how to use :FILL for anything really practical. It seems like a good idea, only partially implemented...
    There is a practical use for FILL - to be honest I got this code snippet from a colleague of mine who is heavily using that - its great to cut out  strings within a big string separated by a separator - used when working with CSV files.
    The :FILL command does seem to be more useful when used in conjunction with GET_PROCESS_LINE or STR_SPLIT. (The documentation barely mentions the latter, by the way. It really ought to include an example like yours for the sake of completeness.)

    What remains unclear to me is whether there is any practical use for :FILL and GET_VAR together.


  • 10.  GET_VAR and :FILL

    Posted Jan 10, 2017 09:08 AM
    Michael Lowry said:
    What remains unclear to me is whether there is any practical use for :FILL and GET_VAR together.
    Yes, same to me...


  • 11.  GET_VAR and :FILL

    Posted Jan 10, 2017 09:54 AM
    It would be nice if one could do something like this:
    :SET &MYVARA# = "UC0.PROFILES.VARA"
    :DEFINE &ARRAY#, string, 25
    :FILL &ARRAY#[] = GET_VAR(&MYVARA#,COLUMN,KEY)
    or
    :SET &MYVARA# = "UC0.PROFILES.VARA"
    :DEFINE &ARRAY#, string, 25
    :FILL &ARRAY#[] = GET_VAR(&MYVARA#,COLUMN,VALUE1)
    or
    :SET &MYVARA# = "UC0.PROFILES.VARA"
    :DEFINE &ARRAY#, string, 25
    :FILL &ARRAY#[] = GET_VAR(&MYVARA#,ROW,"ABC")
    In my idea, the second parameter specifies whether to obtain multiple values from a single column or from a single row.


  • 12.  GET_VAR and :FILL

    Posted May 24, 2017 06:11 AM

    I submitted this an an enhancement request:

    Fill array from VARA row or column using :FILL and GET_VAR 



  • 13.  GET_VAR and :FILL

    Posted May 24, 2017 06:15 AM
    I also thought it might be useful to link to this discussion about the validity area of VARA objects.