NF Validations
August 20, 2022 – Version
1
NF now has multiple validation methods to validate the records.
There are three types of Validate methods
- 1. Record validations
- 2. Table validations
- 3. Relational Validations
In NF tool these are available in Method-Tables – Table Details - “Validation” tab.
- Record validations
- Table validations
- Relational Validation
- a parent record cannot be deleted if child records exist
- a child should meet one or more conditions for a given parent record.
The Record validation is performed on the entered values on the Create/Edit form fields or the Request table fields. Three values are specified (for a request or response table)
Validate Operations
Will be one or more of the operation combinations below. NULL represents any operation.
If the table is a Response table: Create – C, Update – U, Delete – D, Execute – E
If the table is a Request Table, then ReQuest - Q
Validate Condition
Validation condition is written like SQL where condition. The NF field Names (and not db column names) are used in the condition. If the condition succeeds then it is a validation failure.The record cannot be entered for the specified operations.
Validate Message
Specify validation error message for the specified condition.
The Table Validations are performed only on the response tables, prior the data being committed to the data (or prior to executing CUDE methods). The data is validated on the internal NF (temporary) tables. Two values needed for this validation
Validate Operations
Create – C, Update – U, Delete – D, Execute – E. If NULL is specified it is applicable for all operations.
Validate Method Source
A SQL is specified in a special format. The SQL will return only one column “row_validate_message”. The “from” clause of the statement can include regular database tables or NF table name in the format NF@.AccountWithRelation /* Entity Table Name referrred as NF@.<EntityTableName>*/
At run time, this table will be replaced with internal table [#accountwithrelation_88965995799480_18].
The above example is a simple query. However, the query can include other database tables as needed. The SQL can be a multi-line statement for complex validations.
If the SQL succeeds and returns rows, then it is a validation failure.The record will fail for the specified operations.
The purpose of this validation is to make parent-child relational validations. Examples are
The validation condition is specified on the parent table, but the validation query checks the child tables
Validate Operations: The only operation possible is “Navigate”. The record is validated when navigate is performed on parent record.
Validate Method Source:
A SQL is specified in a special format. The SQL will return only one column “row_validate_message”. The “from” clause of the statement can include regular database tables or NF table name in the format NF@.NFSampleAddressTypePermission /* Entity Table Name referrred as NF@.<EntityTableName>*/
NFSampleAddressTypePermission – is the Child Table.
The validate is specified on parent table: NFSampleAddressTypeWithPermission
This relational validation is triggered when navigating (clicking on next or previous rows) on the parent table NFSampleAddressTypeWithPermission, but the validation checks for count of rows in child table NFSampleAddressTypePermission. If no records found child table, error is shown, and the validation fails.
In the sample query above, @address_type_id is used as parameter. This is the key field of the parent table. The key fields of the parent table are automatically sent as parameter to this validation method. The query must include parent key field(s).