Consultor Eletrônico



Kbase P7614: 4GL. How to retrieve the ROWID and RECID of a Buffer within
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/03/2003
Status: Unverified

GOAL:

4GL. How to retrieve the ROWID and RECID of a Buffer within a Dynamic-Query.

FACT(s) (Environment):

Progress 9.X

FIX:

The example code illustrate how to get the RECID and ROWID of a Buffer within a Dynamic-Query.

There is 2 Attributes for the Buffer :ROWID which returns the ROWID of a Buffer and :RECID which returns the RECID.

DEFINE VARIABLE qry1 AS HANDLE.
DEFINE VARIABLE wherev AS CHARACTER INITIAL "WHERE custnum < 10".
DEFINE VARIABLE sortv AS CHARACTER INITIAL "BY salesrep".
DEFINE VARIABLE bval AS LOGICAL.
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE bh AS WIDGET-HANDLE EXTENT 4.

CREATE QUERY qry1.
REPEAT:
  UPDATE wherev FORMAT "x(70)"
  LABEL "Enter WHERE and BY information." SKIP
  sortv FORMAT "x(70)" NO-LABEL.
  qry1:SET-BUFFERS(BUFFER customer:HANDLE, BUFFER order:HANDLE).
  bval = qry1:QUERY-PREPARE("PRESELECT EACH customer " + wherev +
  ", EACH order OF customer " + sortv).

REPEAT i = 1 TO qry1:NUM-BUFFERS:
 bh[i] = qry1:GET-BUFFER-HANDLE(i).
 DISPLAY bh[i]:NAME . /* display the buffer names */
END.

IF (bval = FALSE) THEN NEXT.

 qry1:QUERY-OPEN.

 REPEAT WITH FRAME fr1 ROW 8:
     qry1:GET-NEXT.
     IF (qry1:QUERY-OFF-END) THEN LEAVE.     
      DISPLAY cust.custnum SKIP cust.name SKIP cust.salesrep SKIP
           cust.state SKIP order.ordernum
         WITH SIDE-LABELS.
     MESSAGE cust.NAME "RECID " bh[1]:RECID "ROWID " string(bh[1]:ROWID) VIEW-AS ALERT-BOX.
     

   END.
   qry1:QUERY-CLOSE.
END.
DELETE OBJECT qry1.