PreviousNextIndex

LAST-OF( ) method

Returns TRUE if the current iteration of the query predicate FOR EACH . . . BREAK BY. . . is the last iteration for a new break group.

Return type: LOGICAL

Applies to: Query object handle

Syntax
LAST-OF( level ) 

level

The following example shows how the LAST-OF( ) method is used to identify the last record of a break group:

DEFINE QUERY qCustomer FOR Customer SCROLLING. 
QUERY qCustomer:QUERY-PREPARE("FOR EACH Customer WHERE Customer.CustNum > 50  
  BREAK BY Customer.Country BY Customer.Comments"). 
QUERY qCustomer:QUERY-OPEN. 
REPEAT WITH TITLE "Customers Break By Country and Comments": 
  GET NEXT qCustomer. 
  IF NOT AVAILABLE Customer THEN LEAVE. 
  DISPLAY  
    Customer.Country FORMAT "x(10)"  
    Customer.Comments FORMAT "x(20)" 
    QUERY qCustomer:FIRST-OF(0) LABEL "First" 
    QUERY qCustomer:LAST-OF(0) LABEL "Last" 
    QUERY qCustomer:FIRST-OF(1) LABEL "First Country" 
    QUERY qCustomer:LAST-OF(1) LABEL "Last Country" 
    QUERY qCustomer:FIRST-OF(2) LABEL "First Company" 
    QUERY qCustomer:LAST-OF(2) LABEL "Last Company". 
END. 

See also: FIRST-OF( ) method, OPEN QUERY statement, QUERY-PREPARE( ) method


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex