Skip to main content
Version: 20 R7 BETA

End selection

End selection {( aTable )} -> Function result

ParameterTypeDescription
aTableTableTable for which to test if record pointer is beyond the last selected record, or Default table, if omitted
Function resultBooleanYes (TRUE) or No (FALSE)

Description

End selection returns TRUE when the current record pointer is beyond the last record of the current selection of aTable. End selection is commonly used to check whether or not NEXT RECORD has moved the current record pointer past the last record. If the current selection is empty, End selection returns TRUE.

To move the current record pointer back into the selection, use FIRST RECORD, LAST RECORD or GOTO SELECTED RECORD. PREVIOUS RECORD does not move the pointer back into the selection.

End selection also returns TRUE in the last footer when a report is being printed with PRINT SELECTION or from the Print menu. You can use the following code to test for the last footer and print a special footer for the last page:

  // Method of a form being used as output form for a summary report
 $vpFormTable:=Current form table
 Case of
  // ...
    :(Form event code=On Printing Footer)
  // A footer is about to be printed
       If(End selection($vpFormTable->))
  // Code for the last footer goes here
       Else
  // Code for a footer goes here
       End if
 End case

Example

This form method is used during the printing of a report. It sets the variable vFooter to print in the Footer area on the last page:

  // [Finances];"Summary" Form Method
 Case of
  // ...
    :(Form event code=On Printing Footer)
       If(End selection([Finances]))
          vFooter:="©2001 Acme Corp." // Set the footer for the last page
       Else
          vFooter:="" // Clear the footer for all other pages
       End if
 End case

See also

Before selection
Form event code
LAST RECORD
NEXT RECORD
PRINT SELECTION