ExecuteEdits method: Record class

Syntax

ExecuteEdits([editlevel]);

where editlevels is a list of values in the form:

editlevel1 [+ editlevel2] .  .  .]);

and where editleveln is one of the following 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 in the record. The types of edits performed depends on the editlevel. If no editlevel is specified, all system edits are executed. All editlevels are already defined for the record definition or for the field definition, that is:

  • Reasonable Date Range (Is the date contained within the specified reasonable date range?)

  • 1/0 (Do all 1/0 fields contain only a 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 specified 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 False for the record. The field property EditError is set to True for any fields that are in error. 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 each field in error.

You must use the SetEditTable method to set the prompt tables for fields that are defined with %EditTable in the record definition.

If you’re running an Application Engine program, and you want to do set based ExecuteEdits (as opposed to row-by-row) consider using the meta-SQL construct %ExecuteEdits.

See SetEditTable method: Record class, EditError property: Field class, MessageNumber property: Field class, MessageSetNumber property: Field class, Application Engine: Using Application Engine Meta-SQL.

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 variables.

  • %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:

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

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

&REC.ExecuteEdits();
If &REC.IsEditError Then
   LogError();  /*application specific call */
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 EFFDT field, the current date and 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 SETID on the other records in the current row first, then searches parent rows.

For all other keys, the value used to "select" the correct row in the prompt table record comes only from the record executing the method. No other records (or key field values) are used. You may get unexpected results if not all the keys for the prompt table are filled in (or filled in correctly.)

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.