Question display/export all fields of a buffer handle

davidvilla

Member
How to export or display all the fields in a buffer handle without using buffer-field(n) or buffer-field("fldName")? My program will get the table name as input, create a buffer handle for it, and using a query handle will loop through the records and display them.
 

Cringer

ProgressTalk.com Moderator
Staff member
You can't as far as I know. You have to loop through all the fields.
 

TomBascom

Curmudgeon
If you know the name of the table (and you say that you do) then you could use code similar to:

Code:
find _file no-lock where _file-name = tblName no-error.
for each _field no-lock where _field._file-recid = recid( _file ):
  display _field-name.
end.

But this seems like self-flagellation. If you are already dealing with buffer and query handles why are you trying to avoid buffer-field()?
 

GregTomkins

Active Member
You could do WRITE-XML() or WRITE-JSON on the buffer handle, use "LONGCHAR" as the target-type, then do something with the LONGCHAR, which will contain all the field names and data values. However "do something" will probably look a lot like using buffer-field(n), and, I believe the WRITE-*() methods only work on temp-tables, so you might need to create a TT for that purpose. Seems like a lot of work ;)
 
Top