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

AVEVA™ Work Tasks

Delete Record in a Base Form Control

  • Last UpdatedJun 25, 2024
  • 1 minute read

Consider a BaseForm control containing several TextInput controls and a Delete button with a custom OnClick script as follows:

control.dataContainerForm.removeRecord(control.associatedForm);

// you can also use below script to delete the record

// control.associatedForm.remove();

Here, the control referred to is the Delete button, as specified in the OnClick script.

control.associatedForm represents the record within the BaseForm control while control.dataContainerForm represents the BaseForm control itself.

For a BaseForm control, the removeRecord API, as demonstrated in the script, facilitates the removal of a record.

Another example is the presence of a Number control labeled Record number to delete, where the user can specify the record number to be deleted. Additionally, there is a delete record option with Delete button equipped with a custom OnClick script designed to delete the specified record as shown below:

numberRecordControlValue = control.findByXmlNode("Recordnumbertodelete").value;

var recordNumber = SFU.isNumber(numberRecordControlValue)? parseInt(numberRecordControlValue) : 0;

if (recordNumber > 0 && recordNumber <= control.findByXmlNode("Baseform1").records().length)

{

control.findByXmlNode("Baseform1").removeRecord(

control.findByXmlNode("Baseform1").records()[recordNumber - 1]

);

// you can also use below script by giving the record number to be deleted

// control.findByXmlNode("Baseform1").removeAt(recordNumber); // This method does not require a zero based index value for the record number

}

else

{

SFU.showError(document.title, "Please specify a valid record number");

}

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