First page Back Continue Last page Graphics

Script Expression Validation


Notes:

Script Expression Validation

You can create more complex validation rules using the Groovy language. The Script Expression rule specifies that if an employee belongs to a department, the name of which ends with the letter ā€œS,ā€ the salary must be a multiple of 5. This rule requires conditional logic and also accesses an attribute of the associated Dept entity object.

In this example, you work with the Emp entity object. The validation rule should ensure that anyone who works in a department with a name ending in an ā€œSā€ must have a salary ending in a multiple of 5. Because the department name is only available in the Dept entity, the accessor must be used to refer to the department name.

On the General page of the Entity Object Editor for an entity, go to the Entity Validation Rules section and click the Add Validation Rule button again. In the Add Validation Rule dialog box, select Script Expression from the Rule Types list.