Page 1 of 1

AUTOSORT xBrowse

Posted: Sat Jun 22, 2019 8:44 pm
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

Re: AUTOSORT xBrowse

Posted: Sun Jun 23, 2019 11:49 am
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.