Hello,
I create a function to copy the content of a table given by table ID to a textfile. What I do is:
Table.OPEN(TableID); // Table is of type recordref
FieldCount := Table.FieldCount;
FOR FieldIndex := 1 TO FieldCount DO
BEGIN
// copy fieldcontent to textfile
END;
My problem now is the order of the fields in the textfile is not same as the order of the fields in the table.
This is because the loop uses the fieldindex of the recordref and this goes from 1 to FIELDCOUNT.
What I need is a recordref sorted by FIELDNO as I see if I open a table using the designer.
Is there any way to loop through a recordref variable which is sorted by FieldNo instead of FieldIndex?
Thanks for any help!
Comments
If you need the contents of the record set you could use this
This is using the Payment Terms table and output looks like this
or is it the field names and numbers you want if so just use the "field" table
Albert
Well, you can use the Field table, and loop throug that, and use "FldRef := RecRef.FIELD(Field."No.")" instead of "FldRef := RecRef.FIELDINDEX(FieldIndex)"
Seems I were to slow to press Submit...
Peter