Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reorder table fields
Message
From
24/02/2003 14:38:56
 
 
To
21/02/2003 10:46:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00756108
Message ID:
00757140
Views:
11
>I am doing exactly that...outputting the data to Excel. I need the fields to output in Excel in a certain order because we have macros that run on the spreasheets and look for the data in a certain column. This is proving to be difficult for me as the number / name of fields in the table I am working with always varies, so I don't know how to specify the order I want when I don't really know what is going to be in the table.

You could store the fields list to a variable, lcFields.
Then use SELECT &lcFields FROM ... and so on.

Using the macro expansion lets you create the list of fields to select in your program so that it's not hard coded.

I have found one problem (in VFP7). IF there are no function calls in the select, or it only selects from one table, then the order of the fields in the result is NOT the order you put in the fields list!
My workaround was to use UPPER() around our Primary Key fields, because they are always character and always uppercase anyway. I don't change the data, but it does force VFP to do what I tell it, and not what it feels like :)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform