IT Process Automation

Expand all | Collapse all

populating table IRF

Jump to Best Answer
  • 1.  populating table IRF

    Posted 05-03-2016 10:06 AM

    Hi guys

    I have trouble to preloading records to IRF table. I like doing this by FORM DATA INITIALIZATION CODE, but can’t get success to this way.

     

    I was reading some articles and documentation but don’t get success:

    https://communities.ca.com/thread/241744465

    https://communities.ca.com/message/241694664

    https://communities.ca.com/message/99660536

    https://docops.ca.com/ca-process-automation/4-3/en/reference/form-reference/form-elements/table/ca_pam_settabledatafromjsobject-_id-values

     

    The only way to get is by SCRIPT section IRF inside, configuring ONLOAD event to call the fill table function too. However, this way can’t provide the record values in dynamic way and the values was provide in hard code.

     

    My question is:

    If possible by FORM DATA INITIALIZATION CODE provide the records values to fill IRF table, or; specify the parameters to ONLOAD event?

    In other words: building ONLOAD event function by FORM DATA INITIALIZATION CODE.

     

    Thank you in advance



  • 2.  Re: populating table IRF

    Posted 05-05-2016 10:31 AM

    Hi guys,

    Some idea or suggestion about how to populating or pre-loading records into an IRF table from "FORM DATA INITIALIZATION CODE" ?

     

    Best regards



  • 3.  Re: populating table IRF

    Posted 05-05-2016 10:50 AM

    I'm not sure what data do you need to display in your table but you can use "FORM DATA INITIALIZATION CODE" for pre-loading  some values to standard text fields. Then define in IRF some JavaScript  that can select data from SQL database. To get correct set of data use your pre-loading  values for building condition for the SQL query.



  • 4.  Re: populating table IRF
    Best Answer

     
    Posted 05-05-2016 11:00 AM

    I recently had to do something similar.  What I did was to create the table and another, hidden field on the IRF.  In the process that called the IRF, I converted my data to a JSON object,  and converted the JSON object to a string with the "stringifyJSON" function.  In the form data initialization code, I assign the JSON string to the hidden field.

     

    Finally, in the IRF Script section, I created this function:

    {

      load_table: function() {

        grc_json = ca_pam_convertJSONToJSObject(ca_pam_getTextFieldValue('Form.grc_data_json'));

       ca_pam_setTableDataFromJSObject('Form.grc_updates', grc_json);

      }

    }

     

    The IRF's onLoad trigger calls this function.

     

    Regards,

    Bil