Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local View - Parametric Order by
Message
From
01/06/2001 05:44:39
 
 
To
31/05/2001 16:08:00
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00513391
Message ID:
00513631
Views:
16
Hi!

I'm not sure I understood you corrcetly, but I will try to answer.

Well, you do not need to re-create the view each time. Sorting usually could be done using very good approach with 'USE ... AGAIN' and indexing of view. Indexing is at the local in such case, so it works quite swift.

Try to use that view 2 times, first by usual use, second by USE ... AGAIN. Index it by the main ineractive search field. Second view - set index to the current column and display/edit that view. Each time user tries to use interactive search, do it in the first alias, than locate the record in the second alias by the ID of record from first alias. I'm pretty sure recno() also could work. This way you will have the interactive search, as well as data will be sorted properly.

Anyway, I see no point in the interactive search in the column that is not sorted. For me it looks weird, when you find some record, than next record jumps far away from previous point. It might be useful though...

HTH.

>Each of my forms has a 'List' page with a grid for navigating through the form's primary table. The first column is a seek column. Type in the first few characters and you are taken to that record. This is done with an index on this sort field and an incremental seek. The user can pick which order he wants the table (which is a local view) in.
>
>Our applications require a lot of filling in of blank fields in records. One of the favorite ways to edit is to set the order to the column we are editing. The blank fields are then together at the top. When these fields are filled in of course the record jumps to its proper location. Fill in the vendor field with "Rexnord" and the goes to the location between "Pentex" and "Saveon". You then have to go back to the top of the list to find the next blank field.
>
>What I want to do is to provide a switch to turn off this "Auto Sorting" to keep the record were it was.
>
>What I need to do this is a parametric "Order By" in the create sql view. Something like :
>Solution #1
>
>public gcPublicOrderBy
>gcPublicOrderBy = "eqno"
>create sql view "equip_lv" as ;
>   select eqno,* from equip order by ?gcPublicOrderBy
>*** then
>gcPublicOrderBy = "vendor"
>= requery("equip_lv")
>
> but this does not seem to work, giving me an error message like "Column " " not found".
> neither does :
>Solution #2
>
>gcPublicOrderBy = "eqno"
>create sql view "equip_lv" as ;
>   select eqno,* from equip order by eval(gcPublicOrderBy)
>
>what does work is
>Solution #3
>
>gcPublicOrderBy = "eqno"
>create sql view "equip_lv" as ;
>   select padr(left(eval(gcEQLVOrderBy),30),30) as SortField,;
>     eqno,* from equip order by 1
>
>However I am afraid of a speed problem using eval() in the SQL command since it evaluates for each record. Also it does not seem to allow me to order by columns from child tables I have in the view. For example the column "Vendor" is provided to the view from a join with table vendors. Setting gcEQLVOrderBy = "vendors.vn_name" does not seem to do it either.
>Solution #4
>
>gcPublicOrderBy = "eqno"
>create sql view "equip_lv" as ;
>   select padr(left(&gcEQLVOrderBy,30),30) as SortField,;
>     eqno,* from equip order by 1
>
>is the same as making the view
>
>create sql view "equip_lv" as ;
>   select padr(left(eqno,30),30) as SortField,;
>     eqno,* from equip order by 1
>
>and requires me to rebuild the view everytime the value gcPublicOrderBy changes. Since the view is stored in a shared database on the network there is the possibility that the User #1 would change the view, then User #2 changes the view and then User #1's requery() gets the result User #2 wanted. I do not know how to prevent this other than to build the view in a local DBC on the user's drive.
>
>Does any one have any suggestions?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform