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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrange fields in table view 1

Status
Not open for further replies.

linousa

IS-IT--Management
Mar 8, 2013
79
US
Does anyone know how to move fields fast in browse view? Example: I added a new field in the table with 200 fields and as result I get it the last when I browse that table and I need to move to be the first one. It takes a while dragging it by hand. And moving it in table designer->fields doesn't change anything in browse view.
Untitled_r3npcy.png
 
When you Browse the table, add the "Preference YourTable" phrase to the command line. Then the changes you make will "stick". Replace YourTable with the name of your table or alias. In order for this to work, you must have Set Resource On. See Help on Browse for more info.

If you use SuperBrowse you can use it to create the complete Browse Fields... command line for you, which you can then save as a prg.
 
Do you mean as a permanent positioning within an application's Form?
* If so, then manually define your separate Browse Columns anyway you want.

Or merely in a Browse window in the Development Mode?
* You can use the cursor to move the columns and then next time do a BROSE LAST and VF{ will use the last 'known' configuration.
* Otherwise you can define the field sequence such as: BROSE FIELDS MarchData, User, Mailnum, .....

Good Luck,
JRB-Bldr


 
Thank you for being so fast. Preference just saves the view for that table, but I have it generated on each run and it is pointless to save the view as it's different table each time. The question is - how to rearrange fields fast. "Browse fields" won't work too, I need to see all of them.

Yes, it is in development mode. Browse fields-to many to type. Moving by cursor takes a while to move through 200 fields. Is there a faster way of doing it by cursor, holding some key? I couldn't find find it anywhere.
 
Let me get this right. You have a cursor with 200 fields. You add a new field. The new field appears at the right-hand side of the Browse. You want to drag that field to the left side. Is that correct?

If so, then no, there is no shortcut for doing that - at least, not interactively.

You would probably find it easier to regenerate the cursor, with the new field near the beginning of the field list. By default, a Browse window shows the columns in the same order in which the fields appear in the underlying table or cursor. So that would solve the problem.

I must say I'm curious as to why you want a Browse window with 200 columns. I would have thought that would be just about impossible to manage. I can possibly understand you having a cursor with 200 fields, although that seems a very high number. But why do you need to see them all at the same time, in the same Browse?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I once created a simple utility to browse a table where the fields were sorted alphabetically. You can easily change the code to work as you need. I am about to go to bed, if not I could have done it for you.

[pre]*Brw.prg
Lparameters llReverse, lcMore
Local laDummy[1], ;
lcFieldList As String, ;
lnMaxFields As Number, ;
lnX As Number
If Empty(Dbf())
Return
Endif
If Pcount()<2 Or Vartype(lcMore)#'C'
lcMore=''
Endif
lnMaxFields = Afields(laDummy)
If llReverse
Asort(laDummy, 1, 0, 1, 1)
Else
Asort(laDummy, 1, 0, 0, 1)
Endif
lcFieldList = ''
For lnX = 1 To lnMaxFields
lcFieldList = lcFieldList + laDummy(lnX, 1) + ','
Endfor
lcFieldList = Left(lcFieldList, Len(lcFieldList) - 1) + ' ' + lcMore
Browse Normal Fields &lcFieldList[/pre]
 
What seems strange to me is that a) that table differs every time and b) you want to reorder permanently.

Are you really talking about a cursor or table you create? Simply change the CREATE statement to create the fields in the order you want.
Are you talking about a view as in CREATE SQL View? Quite the same, just redefine your query you use to create the view.

Bye, Olaf.
 
I did figure that holding 'shift' or 'alt keys will run that interactive go faster, not much but...

MikeLewis said:
I must say I'm curious as to why you want a Browse window with 200 columns. I would have thought that would be just about impossible to manage. I can possibly understand you having a cursor with 200 fields, although that seems a very high number. But why do you need to see them all at the same time, in the same Browse?
It is well organized and easy to read/validate data. It is possible to reorganize and group some of this fields, but it is already in place and it is working. Thank you for your respond.

tbleken said:
I got the idea, will try to port it for my case. Thank you!

OlafDoschke said:
Are you really talking about a cursor or table you create?
Question solved, but it was about table view in the development mode. Thank you.

Thank you all, I got more good answers, than expected and learned more, than I thought!
 
>Example: I added a new field in the table with 200 fields

In that sample case adding the column via the table designer you can move the field up. In that moment you can define the order of fields as you like, just ALTER TABLE does not offer that.
Besides you cannot only add a new field at the bottom of the field list of the table designer. The insert button inserts a new field where you are currently positioned in the list and not at the end.

After confirming changes the table designer will rewrite the DBF file anyway, in any case of the normal appending of fields at the right side or wherever you want, so that doesn't make it any less applicable as doing it the SQL way. You just have to be aware this influences the real field order.

Bye, Olaf.
 
OlafDoschke said:
After confirming changes the table designer will rewrite the DBF file anyway, in any case of the normal appending of fields at the right side or wherever you want, so that doesn't make it any less applicable as doing it the SQL way. You just have to be aware this influences the real field order.

Omg, you are totally right, I don't know how I missed that, after making changes in designer and instead of clicking 'browse' button(was doing it for ages) in data session window(calls 'browse last'), I called 'browse' and it pulled the new structure(new order). Thank you![bow]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top