Link to home
Start Free TrialLog in
Avatar of farminsure
farminsureFlag for United States of America

asked on

rearrange fields in a paradox 7 table

I have a paradox table drv.db that is displayed using a twwdbgrid in delphi 4.  The client wants a field that is at the bottom of the table, that displays at the far right in the grid, moved to now be the third field in the order.  I tried using database desktop to do this and works fine on my machine, but when I compile and release to the user it still puts it at the end.  Any ideas on how I could solve my issue, thanks.
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

You can simply change the order of the twwdbgrid columns.
I guess that right now you're simply displaying the fields directly into the grid.
If you use the column editor you can customize the order of the columns and also other features
Avatar of farminsure

ASKER

that sounds great.  is the column editor in the properties of the grid in the object inspector?
Yes. Or you can use the context menu right clicking on the grid in design time
i right clicked do not see the context menu and do not see this editor in the obj inspector Ferruccio68?  I attached a screen shot..this is delphi 4
column.jpg
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Looks like you are doing a select * from the table and you end up with the exact order of the fields as in the database.

One way is to use the actual field names in your select statement select field3, field10, field9, etc
Not a good method

You also have to consider the next time the client wants the tenth field to be displayed in position 6.

A good way to handle this would be to save the configuration either in some ini or xml file or even in a database table
Then let the user be able to drag the columns wherever they wish and you save the positions. Next time the client opens the form, just read in the correct positions and reconfigure your grid accordingly. Now with this method, you dont have to build a new version every time the client decides to change field positions
Thank you Ferruccio68, I didn't even know that feature was available.  This worked!

Do think of what I said about the custom configuration as well.