Whereas validation of user input is one side of the medal, the other is validation of code entered data, the subject of this blog post.
Just as any user input code entered data should be validated before it is allowed to be recorded in the database. A standard way of entering data through code is by the assignment statement:
"Search Name" := Name;
Like in the OnValidate trigger of the Name field on the G/L Account table, where the Search Name field of a record will be assigned the content of the Name field of that record.
By the basic nature of C/SIDE an assignment statement can only be created if the data types match on the both sides of the assignment statement. (Read more about this here.) Hereby data type validation is not needed in run-time, although even if data types match a run time error could occur due to an overflow. (Read more about this here.) . Running the code will however not trigger any (additional) validation.
Now how to trigger additional validations as discussed in my blog regarding the validation of user input? By using the VALIDATE field method.
As the Developer and IT Pro help explains, the syntax for the VALIDATE function is:
Record.VALIDATE(Field [, NewValue])
Where Record (data type: record; subtype: any NAV table) contains the field Field you want to validate. The optional parameter NewValue is the value to be inserted in Field. Needless to say that the Data Type of NewValue must match the data type of Field.
Calling VALIDATE altogether launches a two step process in the following order:
Thus before the OnValidate trigger of the field is executed any system validation will be carried out, like checking of table relations based on the settings of the TableRelation and ValidateTableRelation properties. I.e. the same details apply as have been described here.
The second parameter allows to combine two statements in one, as:
is equal to:
Record.Field := NewValue;Record.VALIDATE(Field);
There are, various MS Dynamics partners have build their solutions to do that.
I am new here, my Email is email@example.com
I am very interested about entered data in Navision. I mean in business processes on the plant floor there are two steps : 1. data is calculated from technically oriented subsystems; 2. enter this controled data into Navision 4.0, valdation is here in this step. My question is : Exist some tools for this ? Thank you.