Automic Workload Automation

Expand all | Collapse all

How to display the VARA values in a PromptSet - ComboBox

  • 1.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 21, 2016 12:54 PM


    You can set the combo box Property "Data reference" to {name of VARA}.


    A combobox is set to always retrieve the first value (not the key) of the VARA object.

    For example, I have a Static VARA called VARA.STATIC.BIND
    gpbcglxdaudu.png

    The ComboBox will be populated with values CONN.SQL.TAM, %CCH%, JOBS.TECH
    wdmjiwzuvls4.png

    Unfortunately, you can't populate the combobox with they Key values or value 2, 3, and so on

    If you want to populate a ComboBox with a value other than value1 (eg: KEY value), a workaround would be to either:
    1) create another VARA where the data that you want are in value1 column
    2) create a script that will pull the Key value from (eg) VARA.STATIC.BIND, and insert the value in another variable (eg: VARA.KEY, and the use VARA.KEY in your ComboBox.  

    :SET &CNT# = 1 :SET &HND#=PREP_PROCESS_VAR(VARA.STATIC.BIND) :PROCESS &HND# :   SET &KEY# = GET_PROCESS_LINE(&HND#,1) :SET &CNT# = FORMAT(&CNT#) :PUT_VAR VARA.KEY, &CNT#,&KEY# :SET &CNT# = ADD(&CNT#, 1) :ENDPROCESS




  • 2.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 22, 2016 11:44 AM
    Unfortunately, you can't populate the combobox with they Key values or value 2, 3, and so on
    I think this should be possible, using an EXEC VARA that calls a SCRI that parses the original VARA and creates a new data sequence with the values from the desired column. I’m trying to do something similar, but have run into an roadblock: CREATE_PROCESS returns $PROCESS02 instead of contents of data sequence.


  • 3.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 22, 2016 05:41 PM
    Michael_Lowry
    Wouldn't your suggestion be sort-of similar to workaround #2? 
    2) create a script that will pull the Key value from (eg) VARA.STATIC.BIND, and insert the value in another variable (eg: VARA.KEY, and the use VARA.KEY in your ComboBox.  


  • 4.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 22, 2016 06:07 PM
    Christine Chavez said:
    Michael_Lowry
    Wouldn't your suggestion be sort-of similar to workaround #2? 
    2) create a script that will pull the Key value from (eg) VARA.STATIC.BIND, and insert the value in another variable (eg: VARA.KEY, and the use VARA.KEY in your ComboBox.  
    Right, except that with my approach, there’s no temporary VARA object to remove afterward.


  • 5.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 26, 2016 03:31 PM
    I took a stab at the method I suggested. First, I created a static VARA object with values in two columns:
                                                                                                                                 

    Key
    Value 1
    Value 2




    1ABC1



    2DEF1



    3GHI2



    4JKL3



    5MNO5



    6PQR8



    7STU13



    8VWX21



    9YZ35


    Next, I made an EXEC VARA:
    91x7u09ir5sg.pnghttps://us.v-cdn.net/5019921/uploads/editor/4j/91x7u09ir5sg.png" width="541">
    Finally, I made the SCRI that the EXEC VARA will execute. Here was my first attempt:

    :SET &Hnd1# = PREP_PROCESS_VAR(UC0.MAL.CREATE_PROCESS_TESTS.VARA_STATIC,,,2)
    :PSET &Result# = SAVE_PROCESS(&Hnd1#)
    :CLOSE_PROCESS &Hnd1#
    :CLOSE_PROCESS &Result#
    The idea is to  use PREP_PROCESS_VAR to create a data sequence containing only the values from column 2, and then simply to save this data sequence for use by the SCRI. When I clicked the Preview button, here were the results:
                                   
    RESULT
    1§§§ABC§§§1§§§§§§§§§§§§◻
    22
    33
    44
    55
    66
    77
    88
    99
    Obviously, something is not right. I tried specifying a different value than 2 for the Column argument, and also tried omitting this argument altogether. Neither made a difference. Next, I tried using CREATE_PROCESS with the DUPLICATE option, to create a copy of the original data sequence:
    :SET &Hnd1# = PREP_PROCESS_VAR(UC0.MAL.CREATE_PROCESS_TESTS.VARA_STATIC,,,)
    :SET &Hnd2# = CREATE_PROCESS(DUPLICATE,&Hnd1#)
    :PSET &Result# = SAVE_PROCESS(&Hnd2#)
    :CLOSE_PROCESS &Hnd1#
    :CLOSE_PROCESS &Hnd2#
    :CLOSE_PROCESS &Result#
    The results were unchanged. (Note by the way, that I am using :PSET instead of :SET. This is important. With just :SET, no results at all are returned.)

    It seems that the Column argument of PREP_PROCESS_VAR is ignored, or does not work as I would expect it to.

    Next, I went ahead and did it the long way, parsing each line of the original STATIC VARA, extracting the value from the desired column, and one-by-one, putting these values into a new data sequence:
    :Set &Counter# = 0
    :SET &Hnd1# = PREP_PROCESS_VAR(UC0.MAL.CREATE_PROCESS_TESTS.VARA_STATIC,,,)
    :PROCESS &Hnd1#
    :  SET &Counter# = &Counter# + 1
    :  IF &Counter# = 1
    :    SET &Hnd2# = CREATE_PROCESS(NEW)
    :    SET &RC# = PUT_PROCESS_LINE(&Hnd2#,"Value2")
    :  ENDIF
    :  SET &Column2Value# = GET_PROCESS_LINE(&Hnd1#,3)
    :  SET &RC# = PUT_PROCESS_LINE(&Hnd2#,&Column2Value#)
    :ENDPROCESS
    :IF &Counter# > 0
    :  PSET &Result# = SAVE_PROCESS(&Hnd2#)
    :ENDIF
    :CLOSE_PROCESS &Hnd1#
    :CLOSE_PROCESS &Hnd2#
    :CLOSE_PROCESS &Result#
    This worked. Here are the results:
                                   
    RESULT
    Value2
    1
    1
    11
    22
    33
    55
    88
    1313
    2121
    3535
    Note that there is an extra PUT_PROCESS_LINE command in the first iteration of the PROCESS loop (when the counter is equal to 1). This is important, because it inserts column headings.

    This solution is a bit verbose, and I had hoped to find a more elegant approach that did not require creating extra data sequences. I do not know why the Column argument of PREP_PROCESS_VAR does not work. Has anyone else had success with this?

    And by the way, when this EXEC VARA is used as the data source for a combo box element in a prompt set, one of the duplicate '1' values is omitted, and only one of them appears in the list. I suppose this is because the items in a combo box list must be unique.


  • 6.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 26, 2016 04:11 PM
    Hi guys,

    i think there might be a simpler (scriptless) workaround using 3 different VARA Objects:
    1. yourSTATIC VARA object (with the keys and columns),
    2. anemptySTATIC VARA (no key, no column)
    3. aMULTIVARA
    Here is how it works:

    Consider the following STATIC VARA from which we want to use Column 3 (Value 2) in a Promptset drop down box:
    9wkjazuc8a3r.pnghttps://us.v-cdn.net/5019921/uploads/editor/zu/9wkjazuc8a3r.png" width="470">

    Create an empty STATIC VARA:
    1pkd5ahvsgax.pnghttps://us.v-cdn.net/5019921/uploads/editor/do/1pkd5ahvsgax.png" width="471">

    Now create a VARA of type MULTI with:
    • your data-filled VARA as"Variable 1",
    • the empty VARA as"Variable 2",
    • "Union" as theoperation,
    • aResult Formatof{3}(=> extract the 3rd overall column of the union, "key" being {1}, "value 1" being {2} etc..)
    i8fzu5u93n4r.pnghttps://us.v-cdn.net/5019921/uploads/editor/xv/i8fzu5u93n4r.png" width="851">

    Now, use this MULTI VARA in your promptset drop down box:

    a1pl1b5zbucu.pnghttps://us.v-cdn.net/5019921/uploads/editor/yv/a1pl1b5zbucu.png" width="802">

    => column "Value 2" is now available in the dropdown menu :)


  • 7.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 26, 2016 05:07 PM
    brendan_sapience_automic
    Thanks. But with this method, how do you get the combobox to display the "Key" value of your static variable? In your case, "1", "2", "3" ?

    I guess I should rename this discussion to "How to display the Key value of a VARA in a ComboBox" because that was the customer's specific question :)

    The script below will extract the Key value and insert in a new VARA. Is there a way to do this without using a script?
    :SET &CNT# = 1 :SET &HND#=PREP_PROCESS_VAR(VARA.STATIC.BIND) :PROCESS &HND# :   SET &KEY# = GET_PROCESS_LINE(&HND#,1) :SET &CNT# = FORMAT(&CNT#) :PUT_VAR VARA.KEY, &CNT#,&KEY# :SET &CNT# = ADD(&CNT#, 1) :ENDPROCESS


  • 8.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 26, 2016 05:11 PM
    Ahhhh, thanks for the clarification Christine_Chavez_6412, totally missed that you were after the Key!

    K, so to get the key in your combobox, simply modify the MULTI VARA to have a "Result Format" of {1}:

    84tf68f3e70q.pnghttps://us.v-cdn.net/5019921/uploads/editor/cr/84tf68f3e70q.png" width="1600">

    that will give you access to the keys!

    (note, i quickly replaced my KEYS (1,2,3) by KEY1, KEY2, KEY3 to better illustrate it.)


  • 9.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jul 26, 2016 05:33 PM
    Thanks brendan_sapience_automic. Definitely a simpler approach than the one I had.


  • 10.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jan 19, 2017 04:49 AM
    ...so to get the key in your combobox, simply modify the MULTI VARA to have a "Result Format" of {1}...
    With your solution as a starting point, I had an idea for a way to dynamically select different subsets of the data, by setting the result format dynamically, e.g., by placing the object variable &RESULT_FORMAT# in the Result Format field. I wonder if this would work.


  • 11.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jan 19, 2017 10:43 AM
    ah, i wonder if that field accepts variables? 

    did you try? that would be an interesting test indeed!


  • 12.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jan 19, 2017 11:17 AM
    ah, i wonder if that field accepts variables? 

    did you try? that would be an interesting test indeed!
    I haven't tried it yet. Based on the fact that curly braces are used in a special way to specify result formats, I would guess that variable resolution is not performed for that field. Either that, or special parsing was developed just for this field.


  • 13.  How to display the VARA values in a PromptSet - ComboBox

    Posted Jan 20, 2017 02:51 AM
    As expected, variables are not resolved in the Result Format field. I tested it in AE version 12.0.0+build.3456.