ExecuteEdits method: Message class

Syntax

ExecuteEdits([editlevels]);

where editlevels is a list of values in the form:

editlevel1 [+ editlevel2] . . .]);

and where editleveln is one of the following system constants:

%Edit_DateRange

%Edit_OneZero

%Edit_PromptTable

%Edit_Required

%Edit_TranslateTable

%Edit_YesNo

Description

The ExecuteEdits method executes the standard system edits on every field for every record in the message executing the method. All edits are based on the record edits defined for the record that the message is based on. The types of edits performed depends on the editlevel. If no editlevel is specified, all system edits defined for the record definition are executed, that is:

  • Reasonable Date Range (Is the date contained within plus or minus 30 days from the current date?)

  • 1/0 (Do all 1/0 fields only contain 1 or 0?)

  • Prompt Table (Is field data contained in the specified prompt table?)

  • Required Field (Do all required fields contain data? For numeric or signed fields, it checks that they do not contain NULL or 0 values.)

  • Translate Table (Is field data contained in the translate table?)

  • Yes/No (Do all yes/no fields only contain only yes or no data?)

Note:

ExecuteEdits does not perform any validation on DateTime fields.

If any of the edits fail, the status of the property IsEditError is set to True for the Message Object executing the method, and any Rowset, Row, Record, or Field Objects that could be instantiated from the same data as the Message Object. In addition, the Field class properties MessageNumber and MessageSetNumber are set to the number of the returned message and message set number of the returned message, for the field generating the error.

If you want to check the field values only for a particular record, you can use the ExecuteEdits method with a record object.

In addition, if you want to dynamically set the prompt tables used for a field (with the %EditTable function) you must use the SetEditTable method.

Parameters

Parameter Description

editlevel

Specifies the standard system edits to be performed against every field on every record. If editlevel isn’t specified, all system edits are performed. editlevel can be any of the following system constants:

  • %Edit_DateRange

  • %Edit_OneZero

  • %Edit_PromptTable

  • %Edit_Required

  • %Edit_TranslateTable

  • %Edit_YesNo

Returns

None.

Example

The following is an example of a call to execute Required Field and Prompt Table edits:

&MSG.ExecuteEdits(%Edit_Required + %Edit_PromptTable);

The following is an example showing how ExecuteEdits() could be used:

&MSG.ExecuteEdits();
If &MSG.IsEditError Then
  Exit(1);
End-If;

Considerations for ExecuteEdits and SetEditTable

If an effective date is a key on the prompt table, and the record being edited doesn’t contain an effective-dated field, the current date/time is used as the key value.

If a setID is a key on the prompt table, and the record being edited doesn’t contain a setID field, the system looks for the setID on the other records in the current row first, then search parent rows.

Considerations for ExecuteEdits and Numeric Fields

A zero (0) might or might not be a valid value for a numeric field. ExecuteEdits processes numeric fields in different ways, depending on whether the field is required:

  • If the numeric field is required: 0 is considered invalid.

  • If the numeric field is not required: 0 is considered valid.