Search code examples
bufferfieldopenedgeprogress-4gl

Is there a way to get static buffer field's name by static reference?


I know there's way to get static buffer's table name with this:

DEF BUFFER Customer_B1 FOR Customer.

DEF VAR cTableName AS CHAR NO-UNDO.

cTableName = BUFFER Customer_B1:HANDLE:TABLE.

Is there a similar way to get buffer field handle and it's field name using static reference?

I would like to use static buffers because they are checked at compile time against the configured database. This means that if some table or field is missing, the codes won't compile. I wouldn't like to use field number or string names to get the field handle.


Solution

  • Not in a static way (e.g. with compile time check for the field name).

    ASSIGN cName     = BUFFER Customer_B1:BUFFER-FIELD ("CustNum"):NAME
           cDataType = BUFFER Customer_B1:BUFFER-FIELD ("CustNum"):DATA-TYPE .
    

    By the way, in your sample above, you can leave out the :HANDLE bit:

    cTableName = BUFFER Customer_B1:TABLE.