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?
Asked
Active
Viewed 2,930 times
1 Answers
10
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.

Tim Kuehn
- 3,201
- 1
- 17
- 23
-
1Excellent! Thank you so much. I couldn't find this anywhere. – Donna Jun 21 '14 at 22:52
-
2They won't let me give any up votes yet. :-/ A reputation score of 15 is required before that is enabled, and mine is 14 at the moment. – Donna Jun 23 '14 at 12:51