RecordDeleted function

Syntax

The syntax of the RecordDeleted 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:

RecordDeleted(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:

RecordDeleted(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).

RecordDeleted(recordname.fieldname)

Description

Use the RecordDeleted function to verify if a row of data has been marked as deleted, either by an end-user row delete (F8) or by a call to DeleteRow.

Note:

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

RecordDeleted is useful during save processing to make processes conditional on whether a row has been deleted.

Deleted rows are not actually removed from the buffer until after the component has been successfully saved, so you can check for deleted rows all the way through SavePostChange PeopleCode.

RecordDeleted is not typically used in a loop, because it is easier to put it on the same scroll level as the rows being checked in SavePreChange or SavePostChange PeopleCode: these events execute PeopleCode on every row in the scroll, so no looping is necessary.

Note:

To avoid confusion, note that this function (like the related functions RecordChanged 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 the target row has been deleted.

  • False if the target row has not been deleted.

Example

This example shows a RecordDeleted call using a contextual reference

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

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

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

Note that the loop is delimited by TotalRowCount. For loops delimited by ActiveRowCount don’t process deleted rows.