RecordChanged function

Syntax

The syntax of the RecordChanged function varies, depending on whether you use a scroll path reference or a contextual reference to designate the row being tested.

Using a scroll path reference, the syntax is:

RecordChanged(scrollpath, target_row)

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.

Using a contextual reference the syntax is:

RecordChanged(RECORD.target_recname)

A contextual reference specifies the current row on the scroll level designated by RECORD. target_recname.

An older construction, in which a record field expression is passed, is also supported. The record field is any field in the row where the PeopleCode program is executing (typically the one on which the program is executing).

RecordChanged(recordname.fieldname)

Description

Use the RecordChanged function to determine whether the data in a specific row has been modified since it was retrieved from the database either by the user or by a PeopleCode program.

Note:

This function remains for backward compatibility only. Use the IsChanged record class property instead.

This is useful during save processing for making updates conditional on whether rows have changed.

Note:

The word "record" is used in this function name in a misleading way. Remember that this function (like the related functions RecordDeleted and RecordNew) checks the state of a row, not a record.

Parameters

Parameter Description

scrollpath

A construction that specifies a scroll level in the component buffer.

RECORD .target_recname

The primary scroll record of the scroll level where the row being referenced is located. As an alternative, you can use SCROLL. scrollname.

Returns

Returns a Boolean value:

  • True if any data in the target row has been changed.

  • False if no data in the target row has been changed.

Example

This example shows a RecordChanged call using a contextual reference:

If RecordChanged(RECORD.BUS_EXPENSE_DTL) Then 
   WinMessage("Changed row msg from current row.", 64); 
End-If;

The following example, which would execute on level one, checks rows on level two to determine which have been changed:

For &I = 1 To ActiveRowCount(RECORD.BUS_EXPENSE_PER, CurrentRowNumber(1),⇒
 RECORD.BUS_EXPENSE_DTL); 
   If RecordChanged(RECORD.BUS_EXPENSE_PER, CurrentRowNumber(1), RECORD.BUS_⇒
EXPENSE_DTL, &I) Then 
      WinMessage("Changed row message from level one.", 64); 
   End-If; 
End-For;