main logo
Subject: Re: Table order
Author: Pamela Thalacker
Posted: 2002/10/09 10:52:55
 
View Entire Thread
New Search


Hi Mark,

<i><font color="#663300">Given that CB seems to promote only accessing tables through views, what's the recommended way to order records? And if the answer is "define it in the view", what about switching order (eg person table by surname or firstname)?</font></i>

Add code like this to your DataEnvironment definition

<pre>FUNCTION INIT()
llRetVal = DODEFAULT()
If llRetVal
llRetVal = llRetVal and This.CreateIndices()
ENDIF
ENDFUNC

FUNCTION CreateIndices()
LOCAL lnOldWA
lnOldWA = SELECT()
IF USED('MyView')
SELECT MyView
=CURSORSETPROP('Buffering',DB_BUFOPTRECORD,'MyView')
INDEX ON LOWER(cLName) TAG cLName
=CURSORSETPROP('Buffering',DB_BUFOPTTABLE,'MyView')
ENDIF
ENDFUNC</pre>

The CDX on the view goes away when you close the view.

Pamela
pamela /AT/ eagle-crest .DO.T com
 
©2002 Pamela Thalacker
<-- Prior Message New Search Next Message -->