FieldChanged function
Syntax
The syntax of the FieldChanged function varies depending on whether you want to use a scroll path reference or a contextual reference to specify the field.
If you want to use a scroll path reference, the syntax is:
FieldChanged(scrollpath, target_row, [recordname.]fieldname)
where scrollpath is:
[RECORD.level1_recname, level1_row, [RECORD.level2_recname, level2_row, ]] RECORD.target_recname
To prevent ambiguous references, you can also use SCROLL.scrollname, where scrollname is the same as the scroll level’s primary record name.
If you want to use a contextual reference, the syntax is:
FieldChanged([recordname.]fieldname)
In this construction the scroll level and row number are determined based on the current context.
Description
The FieldChanged function returns True if the referenced buffer field has been modified since being retrieved from the database either by a user or by a PeopleCode program.
Note:
This function remains for backward compatibility only. Use the IsChanged field class property instead.
This is useful during SavePreChange or SavePostChange processing for checking whether to make related updates based on a change to a field.
Parameters
| Parameter | Description |
|---|---|
|
scrollpath |
A construction that specifies a scroll level in the component buffer. |
|
[recordname.]fieldname |
The name of the field where the value to check is located. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to FieldChanged is not on the record definition recordname. |
|
target_row |
The row number of the target row. If this parameter is omitted, the function assumes the row on which the PeopleCode program is executing. |
Example
The following example checks three fields and sets a flag if any of them has changed:
/* Set the net change flag to 'Yes' if the scheduled date, scheduled */
/* time or quantity requested is changed */
If FieldChanged(QTY_REQUESTED) Or
FieldChanged(SCHED_DATE) Or
FieldChanged(SCHED_TIME) Then
NET_CHANGE_FLG = "Y";
End-If;
Related Functions
Save PeopleCode programs (SaveEdit, SavePreChange, SavePostChange) normally process each row of data in the component. The following four functions enable you to control more precisely when the Component Processor should perform save PeopleCode:
-
FieldChanged
-
RecordChanged
-
RecordDeleted
-
RecordNew
These functions enable you to restrict save program processing to specific rows.
Related Topics