Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In some use cases you want to manipulate an Element the moment it is created (a “new row”). For this you can use the Created annotation on a method in your Customization Java Class. The XML Data Control will call your java method if a new Element is created.

Code Block
languagejava
@Created
public void elementCreated(XMLDCElement employee) { 
employee.putInternal("hireDate", new Date()); 
}


The method has a void return type and the XMLDCElement as input parameter. 
The name of the method needs to be ‘elementCreated’, else the Data Control will throw an InvalidMethodSignatureException.
In this case we will set the default hireDate to the current sysdate on the creation of a new Employee element.

Drag and drop the ‘Create’ operation on the form, so we can create a new element.
Image Added

Run the page and click the Create button, you will see the employee form is created with the sysdate as default:
Image Added