If the user edits a field, the field data is considered altered (even if the user changes it back to the original value before leaving the field). Note that if the user selects the current value of the field from a choice list, the field would also be considered altered; this is because the system automatically copies the current choice list item to the field even if it overwrites the same value.
The altered condition means that the data displayed in the field may not match the value in the underlying variable. To test for the altered condition, use fld_isaltered():
|
fld_isaltered() returns a non-zero value if the field has been edited since being displayed. 0L is returned if the data variable contents matches that shown in the field.
When FORCECONVERT is ON for a field, the altered flag is reset after the conversion takes place. Since the altered flag tests whether or not the value in the field may differ from the value in the underlying data variable, the field is not considered altered because these values match. For a field that contains changed data and also has the FORCECONVERT option ON, fld_isaltered() will return a non-zero value in the validation function and end-field function for that field; it will return false after the user has moved to another field on the form.
You can use fld_isaltered() in field validation functions, end-field functions, and form validation functions. Do not use fld_isaltered() in end-form functions; the data has already been validated and placed into the data variables, and the flag that indicates whether the field has been altered has been reset.