Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 632
Donna Avatar asked Jun 20 '14 21:06

Donna


1 Answers

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.
like image 115
Tim Kuehn Avatar answered Oct 17 '22 14:10

Tim Kuehn