IT Process Automation

Expand all | Collapse all

dynamically generating a table and setting a Select option

Jump to Best Answer
  • 1.  dynamically generating a table and setting a Select option

    Posted 06-01-2015 12:29 PM

    Hi all,

     

    I'm having some trouble with a SRF I'm working on.  The form has a table with dynamically generated contents.  The table has two columns: a name (text field) and a Select list with two possible options. The problem I have is that ca_pam_setTableDataFromJSObject doesn't seem to work to set data for non text-type fields (eg, a Select list), and I can't figure out if there's a way to refer to the IDs of individual controls inside the table so that I can call ca_pam_selectOption on them.  Any advice?

     

    Thanks,

    Sam



  • 2.  Re: dynamically generating a table and setting a Select option
    Best Answer

    Posted 06-04-2015 08:58 PM

    Hi Sam,

     

    I've been trying to puzzle this out -

     

    I managed to get at the run-time value of a select field of a table in PAM with JSON.stringify() -

     

     

     

    It looks like this, where 'var_0' is the id of the select field in the table:

     

    "var_0":"option{name=option1, value=1}"

     

    I was unable to identify what sort of object that is - it's sort of weird syntax for JSON, what with the '=' signs and all.

     

    Maybe you'll have better luck with figuring that out than I did?

     

    Anyway, I do have a suggestion on another way to skin the cat, as it were.

     

    If you can get at the JS object prior to loading it to the table, and you use a checkbox instead of a two option select field, you can just treat the checkbox as an additional boolean value -

     

    So say you have a table with columns 'myitem' and 'myboolean' -

     

    for (item=0;item<tableData.length;++item){

    tableData[item].myboolean = true;

    }

     

    then just load 'tableData' to your table with ca_pam_setTableDataFromJSObject()

     

    That of course only works if your select never gets bigger than two items, but it might be a good stop-gap until you can solve the other issue.



  • 3.  Re: dynamically generating a table and setting a Select option

    Posted 06-09-2015 11:28 AM

    Thanks for your response, JR!

     

    After going back over through the documentation a few times, I realized that I was trying to do something unnecessarily hard in order to get to the values of those fields. What I eventually wound up doing was just using ca_pam_getTableData(), which I think is going to work just fine.

     

    Thanks again for your time, and I hope I didn't send you on too much of a wild-goose chase.