Display the table record dyanamically

kingganesh04

New Member
for the below code i want to display the table instead of deleting the record.

DEFINE VARIABLE a AS CHARACTER NO-UNDO.
UPDATE a
run DeleteThisTable (a).
PROCEDURE DeleteThisTable :
DEFINE INPUT PARAMETER ipcTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE hBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hQueryHandle AS HANDLE NO-UNDO.
CREATE BUFFER hBufferHandle FOR TABLE ipcTableName.
CREATE QUERY hQueryHandle.
hQueryHandle:SET-BUFFERS(hBufferHandle ).
hQueryHandle:QUERY-PREPARE("for each " + ipcTableName + " NO-LOCK").
hQueryHandle:QUERY-OPEN.
REPEAT:
hQueryHandle:GET-NEXT().
IF hQueryHandle:QUERY-OFF-END THEN
LEAVE.
DO TRANSACTION:
hQueryHandle:GET-CURRENT(EXCLUSIVE-LOCK).
hBufferHandle :BUFFER-DELETE ( ).
END. /* DO */
END. /* REPEAT */
END PROCEDURE.
 

DevTeam

Member
I don't know if there's a way to display the table as easily as with a "static" buffer, but you can loop on each field and display its value (with NUM-FIELDS / BUFFER-FIELD(i):BUFFER-VALUE).


EDIT : and I think you could avoid lots of GET-CURRENT in your example by replacing your REPEAT loop by
Code:
hQueryHandle:GET-FIRST().
DO WHILE NOT hQueryHandle:QUERY-OFF-END :
  hBufferHandle :BUFFER-DELETE ( ).
  hQueryHandle:GET-NEXT().
END.
 hQueryHandle:CLOSE-QUERY().
 

kingganesh04

New Member
Thanks, I have one more question. In progress, How can i get the sequence current value dynamically.
My input is database name and one condition we don't create (.p) dynamic program in the home path.
Is it possible?
 
Top