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

AVEVA™ Work Tasks

control​.dataContainerForm

  • Last UpdatedJun 25, 2024
  • 1 minute read

Use dataContainerForm method to get the immediate container form object.

Syntax

control.dataContainerForm;

Parameters

None.

Return Value

This method returns a control object.

Example

// Consider a Base Form with Text controls for

// Employee ID, First Name, and Last Name, and a

// Button control for looking up duplicate names in the form.

// Define On Click script for the Button control.

baseFormObj.items()[0].findByXmlNode("EmployeeID");

// Get the associated record to which the Button control belongs to.

var associatedForm = control.associatedForm;

// Get the First Name for comparison.

var firstName = associatedForm.findByXmlNode("FirstName").value;

// Get the Last Name for comparison.

var lastName = associatedForm.findByXmlNode("LastName").value;

// Get the main container form which contains all the records.

var dataContainerForm = control.dataContainerForm;

var records = dataContainerForm.records();

var totalRecords = records.length;

// Define record index which needs to be skipped for comparison.

var currentRecordIndex = records.indexOf(associatedForm);

// Define duplicates found flag.

var duplicatesFound = false;

// Traverse through the records.

for (var i = 0; i < totalRecords; i++)

{

  // Skip the record index, which needs to be skipped for comparison.

  if (i == currentRecordIndex)

{

  continue;

}

  var recordObj = records[i];

  // Compare the first and the last names.

  if ((recordObj.findByXmlNode("FirstName").value == firstName) &&

(recordObj.findByXmlNode("LastName").value == lastName))

{

// Set the duplicate flag.

duplicatesFound = true;

  break;

}

}

// Check the duplicate flags and show appropriate messages.

if (duplicatesFound)

{

skeltaUtils.showAlert("Duplicates Found!");

}

else

{

skeltaUtils.showAlert("No Duplicates Present!");

}

Refer to Delete Record in a Base Form Control for more example(s).

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