Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reordering tables 1

Status
Not open for further replies.

tedbain

Technical User
Aug 15, 2001
19
AU
I have some tables with around 100 fields and am thinking of reordering the columns. Does anybody have any tricks for doing this??

again any help appreciated

Ted
 
1) copy to new_str stru extended
2) modi stru ... add field "new_order" N(3)
3) brow ...fill appropriate new_order
4) index on new_order tag new_order
5) crea new_file from new_str
6) appe from old_file
 
Tedbain,
Reordering columns, (if I understand your question) is very simple... (I assume you want to simple rearrange the order in which columns appear when "Browsing" the talbe with BROWSE NORMAL...). Open the table in a work area, exclusively. From the command window enter:


USE <pathtotable>\<tablename> EXCL

Then, from the Top Line menu click:

WINDOW
then select
VIEW

From the &quot;View&quot; window, click the

SETUP <button>

Then, on the screen that comes up, click on the
Modify <button>

There are little buttons on the left side of the window that appear. They have no &quot;Label&quot;, but are just square, gray buttons. If you click on one, you will see an &quot;Up and Down&quot; arrow. (It points both Up or Down). You can then, &quot;Drag&quot; the field (aka Column) name up or down in the list. When you release the button, that is where the column will &quot;Stay&quot;. Just move them around until you have the columns in the order you want. When you then Browse the table (in particular with the BROWSE NORMAL command), they will be in the new order you have placed them in.


Cheers

Best Regards,
Scott

Please let me know if this has helped [hammer]
 
Ted...

&quot;reordering the columns&quot;

Why do you want to do this?

If your answer is just to have similar fields next to each other in a BROWSE window, you could do something like this...

BROW FIELDS field1, field99, field25, field2

etc...etc...

Note: this only changes the VIEW of how the fields are displayed in the BROWSE window, the under lying table remains the same.

This is the least *risky* of the above (good) suggestions.

HTH - Wayne
 
Scott .. thanks for your effort but that was where I started from and it gets very laborious with 100 cols.

Tesar .. tried what you said. Just what I wanted except I think you dropped a line. I found that the recreation ignored indexing but having been given the right pointers by you, I used select from new_str into new_str2 and took it from there.

Thanks, Ted
 
Sorry, it was newer tested.
Although max columns is 255, most of my tables has
max 20 fields, to appropriate fill one screen.
For reordering i use only MODI STRU...
Tesar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top