Hi All,
I just asked myself the question if it woudl be possible to use a FIND statement to find a certain record within a dynamically created temp-table (in place the result is just 1 record of course) or do we always have to create a query with a FOR EACH, even
if the result is only one record ?
/* handle to temp table */
CREATE TEMP-TABLE ttHandle.
/* table which we use*/
ttHandle:CREATE-LIKE("krediet").
/* needed fiels, all in this case*/
ttHandle:ADD-FIELDS-FROM("krediet").
ttHandle:TEMP-TABLE-PREPARE("ttKrediet").
/* buffer handle to temp-table */
bfHandle = ttHandleEFAULT-BUFFER-HANDLE.
/* Create Query for tt*/
CREATE QUERY qHandle.
/* handle to temp-table buffer */
qHandle:SET-BUFFERS(bfHandle).
/* Query to find 1 record
ASSIGN cQuery = "FOR EACH ttKrediet WHERE ttKrediet.ln-nr = " + STRING(lening.ln-nr) +
" AND ttKrediet.kl-nr = " + STRING(lening2.kl-nr) +
" AND ttKrediet.kr-nr = " + STRING(cRow).
/* prepary query */
qHandle:QUERY-PREPARE(cQuery).
/* run query */
qHandle:QUERY-OPEN().
qHandle:GET-NEXT().
IF NOT qHandle:QUERY-OFF-END THEN
DO:
ASSIGN
fHandle1 = bfHandle:buffer-field("KT-CODE")
fHandle2 = bfHandle:buffer-field("KR-NAAM").
MESSAGE fHandle1:BUFFER-VALUE() SKIP fHandle2:BUFFER-
VALUE().
END.
/* release objecten & handles */
qHandle:QUERY-CLOSE().
DELETE OBJECT qHandle.
Thanx for any Response
Emmanuel Nuyttens
C&C NV - Oudenaarde - Belgium
I just asked myself the question if it woudl be possible to use a FIND statement to find a certain record within a dynamically created temp-table (in place the result is just 1 record of course) or do we always have to create a query with a FOR EACH, even
if the result is only one record ?
/* handle to temp table */
CREATE TEMP-TABLE ttHandle.
/* table which we use*/
ttHandle:CREATE-LIKE("krediet").
/* needed fiels, all in this case*/
ttHandle:ADD-FIELDS-FROM("krediet").
ttHandle:TEMP-TABLE-PREPARE("ttKrediet").
/* buffer handle to temp-table */
bfHandle = ttHandleEFAULT-BUFFER-HANDLE.
/* Create Query for tt*/
CREATE QUERY qHandle.
/* handle to temp-table buffer */
qHandle:SET-BUFFERS(bfHandle).
/* Query to find 1 record
ASSIGN cQuery = "FOR EACH ttKrediet WHERE ttKrediet.ln-nr = " + STRING(lening.ln-nr) +
" AND ttKrediet.kl-nr = " + STRING(lening2.kl-nr) +
" AND ttKrediet.kr-nr = " + STRING(cRow).
/* prepary query */
qHandle:QUERY-PREPARE(cQuery).
/* run query */
qHandle:QUERY-OPEN().
qHandle:GET-NEXT().
IF NOT qHandle:QUERY-OFF-END THEN
DO:
ASSIGN
fHandle1 = bfHandle:buffer-field("KT-CODE")
fHandle2 = bfHandle:buffer-field("KR-NAAM").
MESSAGE fHandle1:BUFFER-VALUE() SKIP fHandle2:BUFFER-
VALUE().
END.
/* release objecten & handles */
qHandle:QUERY-CLOSE().
DELETE OBJECT qHandle.
Thanx for any Response
Emmanuel Nuyttens
C&C NV - Oudenaarde - Belgium