Progress
Language Reference


CLOSE QUERY Statement

Interfaces
OS
SpeedScript
All
All
Yes

Closes a query that was opened by a previous OPEN QUERY statement.

SYNTAX

CLOSE QUERY query 

query

The name of an open query.

EXAMPLE

The r-clsqry.p procedure defines a query, q-cust, which it shares with r-query.p. Each time you choose the Ascending, Descending, or Cust-Num button, the procedure opens a new query for q-cust. To do this, the procedure must first close an open query for each q-cust. Therefore, the CLOSE QUERY statement is used in the CHOOSE trigger for each of these buttons.

r-clsqry.p 
DEFINE NEW SHARED BUFFER x-cust FOR customer.
DEFINE NEW SHARED QUERY  q-cust FOR x-cust.

DEFINE BUTTON b_quit LABEL "Quit"
  TRIGGERS:
    ON CHOOSE QUIT.
  END.
  
DEFINE BUTTON b_ascend  LABEL "Ascending".
DEFINE BUTTON b_descend LABEL "Descending".
DEFINE BUTTON b_num     LABEL "Cust-Num".

FORM b_ascend b_descend b_num b_quit
  WITH FRAME butt-frame ROW 1.

ON CHOOSE OF b_ascend
DO:
  CLOSE QUERY q-cust.
  OPEN QUERY q-cust FOR EACH x-cust NO-LOCK
    BY x-cust.name.
  DISABLE ALL WITH FRAME butt-frame.
  RUN r-query.p.
END.

ON CHOOSE OF b_descend
DO:
  CLOSE QUERY q-cust.
  OPEN QUERY q-cust FOR EACH x-cust NO-LOCK
    BY x-cust.name DESCENDING.
  DISABLE ALL WITH FRAME butt-frame.
  RUN r-query.p.
END.

ON CHOOSE OF b_num
DO:
  CLOSE QUERY q-cust.
  OPEN QUERY q-cust FOR EACH x-cust NO-LOCK
    BY x-cust.cust-num.
  DISABLE ALL WITH FRAME butt-frame.
  RUN r-query.p.
END.

DO WHILE TRUE:
  ENABLE ALL WITH FRAME butt-frame.
  WAIT-FOR CHOOSE OF b_ascend, b_descend, b_num, b_quit.
END. 

r-query.p
DEFINE SHARED BUFFER x-cust FOR customer.
DEFINE SHARED QUERY  q-cust FOR x-cust.

GET FIRST q-cust.

DO WHILE AVAILABLE(x-cust):
  DISPLAY x-cust.name
          x-cust.cust-num
    WITH FRAME cust-info CENTERED DOWN ROW 3 USE-TEXT.
  DOWN 1 WITH FRAME cust-info.
  GET NEXT q-cust.
END. 

NOTES

SEE ALSO

CURRENT-RESULT-ROW Function, DEFINE QUERY Statement, GET Statement, NUM-RESULTS Function, OPEN QUERY Statement, REPOSITION Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095