Search code examples
openedgeprogress-4gl

Is it possible to give scope defined value for handle? - PROGRESS 4GL


Is it possible to give something like below?

&SCOPED-DEFINE Tablename "Customer".

DEFINE VARIABLE hFieldBufferHandle  AS HANDLE NO-UNDO.
DEFINE VARIABLE icount AS INTEGER NO-UNDO.

 hFieldBufferHandle = BUFFER Customer:handle.
 /* hFieldBufferHandle = BUFFER {&Tablename}:handle.     /*What I need..will be helpful if it has to be defined inside the loop*/ */

 do icount = 1 to hFieldBufferHandle:NUM-FIELDS:
    DISP buffer Customer:buffer-field (icount):label. 
 end.

Solution

  • As Tom says, you just create the buffer handle dynamically, since you currently just want the column labels:

    def var hb as handle no-undo.
    def var ic as int    no-undo.
    
    create buffer hb for table 'customer'.
    
    do ic = 1 to hb:num-fields:
       message hb:buffer-field( ic ):label.
    end.
    
    finally:
       delete object hb no-error.
    end finally.
    

    Also do not forget, if you create it, you generally need to delete it.

    https://abldojo.services.progress.com/?shareId=624ebdd93fb02369b2543eaa