Search code examples
temp-tablesprogress-4glopenedge

In progress 4gl get field names of temp-table


I have some temp-tables in my script that I will be exporting to a csv file. I need to also export the field names as well as their values. How can I get the field names of temp-tables?


Solution

  • Here's a quick and dirty example of what you're asking for:

    define temp-table tt1
      field f1 as character
      field f2 as decimal
      .
    
    def var iCnt as integer no-undo.
    
    create tt1.
    assign 
       tt1.f1 = "f1"
       tt1.f2 = 123.456
       .
    
    do icnt = 1 to buffer tt1:num-fields:
    
       display buffer tt1:buffer-field(icnt):name
               buffer tt1:buffer-field(icnt):buffer-value
           with down
           .
    
       down.
    
    end.