Previous Next

CREATE QUERY statement
Creates a dynamic query.
Syntax 
 
CREATE QUERY handle
 [ IN WIDGET-POOL widget-pool-name ]
handle
A variable of type HANDLE that represents the handle of the query object.
IN WIDGET-POOL widget-pool-name
An expression of type CHARACTER that evaluates, at run time, to the name of the widget pool that contains the dynamic query.
Note:
Example 
The following example creates a dynamic query with a static buffer and a dynamic predicate (WHERE clause) which is resolved at run time:
 
/* r-crtqry.p */
 
DEFINE VARIABLE hQuery  AS HANDLE  NO-UNDO.
DEFINE VARIABLE iNumVar AS INTEGER NO-UNDO INITIAL 10.
 
CREATE QUERY hQuery.
 
hQuery:SET-BUFFERS(BUFFER Customer:HANDLE). 
hQuery:QUERY-PREPARE("FOR EACH Customer WHERE Customer.CustNum < " +
  STRING(iNumVar)).
hQuery:QUERY-OPEN.
 
REPEAT WITH FRAME y:
  hQuery:GET-NEXT().
  IF hQuery:QUERY-OFF-END THEN LEAVE.
  DISPLAY 
    Customer.CustNum
    Customer.Name FORMAT "x(30)"
    Customer.City FORMAT "X(20)".
END.
 
hQuery:QUERY-CLOSE()
DELETE OBJECT hQuery.
Notes 
*
See also 
CREATE BUFFER statement, DEFINE QUERY statement, QUERY-OPEN( ) method, QUERY-PREPARE( ) method

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.