[Stackoverflow] [Progress OpenEdge ABL] How add only required fields from table to dynamic temp table? - PROGRESS 4GL

Status
Not open for further replies.
B

Bharat

Guest
I am new to progress 4gl and below is the query used to add all fields from a table to dynamic temp table except few fields but I am not sure how to add only required fields to dynamic temp table. Please help to modify the query I shared.

Code:
/* p-ttdyn2.p - a join of 2 tables */
DEFINE VARIABLE tth4 AS HANDLE.
DEFINE VARIABLE btth4 AS HANDLE.
DEFINE VARIABLE qh4 AS HANDLE.
DEFINE VARIABLE bCust AS HANDLE.
DEFINE VARIABLE bOrder AS HANDLE.
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE fldh AS HANDLE EXTENT 15.

bCust = BUFFER customer:HANDLE.
bOrder = BUFFER order:HANDLE.

CREATE TEMP-TABLE tth4.
tth4:ADD-FIELDS-FROM(bCust,"address,address2,phone,city,comments").
tth4:ADD-FIELDS-FROM(bOrder,"cust-num,carrier,instructions,PO,terms").
tth4:TEMP-TABLE-PREPARE("CustOrdJoinTT").
btth4 = tth4:DEFAULT-BUFFER-HANDLE.

FOR EACH customer WHERE cust.cust-num < 6, EACH order OF customer:
  btth4:BUFFER-CREATE.
  btth4:BUFFER-COPY(bCust).
  btth4:BUFFER-COPY(bOrder).
END.

/* Create Query */
CREATE QUERY qh4.
qh4:SET-BUFFERS(btth4).
qh4:QUERY-PREPARE("for each CustOrdJoinTT").
qh4:QUERY-OPEN.

REPEAT WITH FRAME zz DOWN:
 qh4:GET-NEXT.
IF qh4:QUERY-OFF-END THEN LEAVE.
 REPEAT i = 1 TO 15:
  fldh[i] = btth4:BUFFER-FIELD(i).
  DISPLAY fldh[i]:NAME FORMAT "x(15)"
  fldh[i]:BUFFER-VALUE FORMAT "x(20)".
 END.
END.

btth4:BUFFER-RELEASE.
DELETE OBJECT tth4.
DELETE OBJECT qh4.

Continue reading...
 
Status
Not open for further replies.
Back
Top