Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Use Data from Parameterized Data Grid in Base Form

  • Last UpdatedJun 25, 2024
  • 2 minute read

You can populate controls on a Base Form on selection of a record in a Data Grid, using data from another Data Grid set as Data Source.

Here we will use the Work Order data lookup to populate the Jobs data grid on selection of a Work Order ID from the Work Order data lookup. Then we will populate the controls in the Job Steps base form from the selection of the record in the Jobs data grid, using data from Job Steps data grid that was set as data source.

  1. Create 3 lookups (Database, Repository List, or Web API):

    - Work Order

    - Jobs (parameterized on Order ID from Work Order lookup)

    - Job Steps (parameterized on Work Order ID and Jobs ID from Jobs lookup)

  2. Create a Grid Configuration using the lookups:

    - Jobs

    - Job Steps

  3. Create a form, and add a Data Lookup control for Work Order lookup.

  4. Modify properties of the Data Lookup control (Work Order) as follows:

    1. In the Basic tab, set the Lookup Source property to the Work Order lookup created in Step 1.

  5. Add a Data Grid control for Jobs lookup.

  6. Modify properties of the Data Grid control (Jobs) as follows:

    1. In the Basic tab, set the Configuration Name property to the grid configuration created in Step 2, and set the Parameters as Work Order (that is the Work Order data lookup control).

    2. In the Advanced tab, set the Select First Record property to Yes to automatically select the first record when the Data Grid control is loaded.

  7. Add a Data Grid control for Job Steps lookup.

  8. Modify properties of the Data Grid control (Job Steps) as follows:

    1. In the Basic tab, set the Configuration Name property to the grid configuration created in Step 2, and set the Parameters as Work Order ID and Jobs ID (from Jobs data grid control).

    2. In the Advanced tab, set the Behavior property to Data Source.

  9. Add a Base Form container control for Job Steps.

  10. Add 3 controls to the record of the Base Form container control (Job Steps) as follows:

    - Text control for JobStepDescription

    - Number control for ProcessOrderID

    - Number control for BatchNumber

  11. Modify properties of the Data Grid control (Jobs Steps) as follows:

    1. In the Advanced tab, set the script for the On Data Bound property as follows to populate the controls on the record of the Base Form container control (Job Steps):

    // Here B1 is the Job Steps Base Form container control.

    var b1 = control.findById("B1");

    b1.removeAll();

    var stepsSource = control.source;

    if (stepsSource && stepsSource.length > 0)

    {

    ko.utils.arrayForEach(stepsSource, function (parameter)

    {

    var newRecord = b1.addRecord();

    newRecord.findById("T1").value = parameter.JobStepDescription;

    newRecord.findById("N1").value = parameter.ProcessOrderID;

    newRecord.findById("N2").value = parameter.BatchNumber;

    });

    }

Related Links
TitleResults for “How to create a CRG?”Also Available in