First-of and Last-of

Arnaud_

New Member
Hi,

Is there any method to do a "break by", with "first-of" and "last-of", in a dynamic query?
Otherwise, how would you do?

Thank you.
 
from progress help

Code:
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.
 

j4n

Member
/edit:
I'm too slow I guess...

10.2b progress doc says:
Code:
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.
check "FIRST-OF( )" and "LAST-OF( )"-Methods
 

Cringer

ProgressTalk.com Moderator
Staff member
Should point out that AFAIK this is OpenEdge 10 functionality and won't work in version 9 if you're using it. But then why would you be as it's obsolete? ;)
 

Arnaud_

New Member
Actually, i used to work on progress V9... i didn't know these methods.
But i'm recently on progress V10 so... thanks to you! ;)
 
Top