Home > Archive > Visual FoxPro SQL Queries > January 2006 > Changing The Sort Sequence Of A View









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Changing The Sort Sequence Of A View
Andy Trezise

2006-01-11, 9:24 am

Is is possible to use a parameter to change the sort sequence of a View at
runtime? I know I can use an index but that seems a bit long winded.


Cindy Winegarden

2006-01-11, 1:24 pm

Hi Andy,

How about creating your view at runtime using macro expansion?

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@msn
.com www.cindywinegarden.com


"Andy Trezise" <andy@work.com> wrote in message
news:%23xKzGarFGHA.2040@TK2MSFTNGP14.phx.gbl...
> Is is possible to use a parameter to change the sort sequence of a View at
> runtime? I know I can use an index but that seems a bit long winded.
>



Stefan Wuebbe

2006-01-12, 7:24 am


"Andy Trezise" <andy@work.com> schrieb im Newsbeitrag
news:%23xKzGarFGHA.2040@TK2MSFTNGP14.phx.gbl...
> Is is possible to use a parameter to change the sort sequence of a View at runtime? I
> know I can use an index but that seems a bit long winded.


I believe [Create View As ... Order By &?yourVariable]
might work - but actually creating local index tags is the
"cheapest" way in practice.
One advantage is that you don't need to Requery() but a
Set Order on the local data subset is enough and much quicker
with a huge backend.

In addition to Cindy's advice - creating views at runtime gives
DBC bloat, as long as you do not create the entire views-only.DBC
on the fly, too.


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------


AA

2006-01-26, 5:01 pm

Another solution is to index the view cursor. It can be indexed and
reindexed as much as you want, and the index updates when the view is
requeried.
Switching indexes might be faster then requerying with a new ORDER BY
clause.

-Anders

"Andy Trezise" <andy@work.com> skrev i meddelandet
news:%23xKzGarFGHA.2040@TK2MSFTNGP14.phx.gbl...
> Is is possible to use a parameter to change the sort sequence of a View at
> runtime? I know I can use an index but that seems a bit long winded.
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com