AUTOSORT xBrowse

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

AUTOSORT xBrowse

Post by Otto »

Dear Mr. Rao,
how can we use AUTOSORT with dbf files which do not have indexes.
Should we create for every field an index.
I tryed with FW_CdxCreate(,.t.) .
Is this the right way or is there an ad hoc indexing way. Only for one column.

Thank you in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: AUTOSORT xBrowse

Post by nageswaragunupudi »

I tryed with FW_CdxCreate(,.t.) .
Yes, this is the right way.
This creates index tags on all columns in a temporary index. This index will be removed after the dbf is closed. Useful for autosort.

Code: Select all

function TempTest()

   local oDlg, oBrw

   USE CUSTOMER SHARED NEW VIA "DBFCDX"
   FW_CdxCreate( nil, .t. )  // create temporary index

   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS AUTOSORT ;
      CELL LINES NOBORDER

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

return nil
 
FW_CdxCreate( [cFieldList], [lMemory] )

You can create index on one or more fields by specifying the list of fields in the first parameter. Default is all fields.
If lMemory is .t., a temporary index is created in memory. By default, it creates a normal index on the disk and we need to open the dbf in exclusive mode.
Regards

G. N. Rao.
Hyderabad, India
Post Reply