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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With