Alaska Software Inc. - collation table in cdx file
Username: Password:
AuthorTopic: collation table in cdx file
Atomekcollation table in cdx file
on Wed, 14 Apr 2010 11:41:19 +0200
Hi

I move my old clipper'87 application to xbase. I have user defined collation 
table (polish). When I create an index using the modes FOXPRO_2X or index 
NTX everything is correct.  However, I would like to use, as is recommended 
in the documentation, VISUAL_FOXPRO mode,  but in this mode, order in the 
table is incorrect.
Some advice please

Tomasz Adamczyk
Clayton JonesRe: collation table in cdx file
on Mon, 26 Apr 2010 13:27:11 -0400
Hello Tomasz,

>I move my old clipper'87 application to xbase. I have user defined collation 
>table (polish). When I create an index using the modes FOXPRO_2X or index 
>NTX everything is correct.  However, I would like to use, as is recommended 
>in the documentation, VISUAL_FOXPRO mode,  but in this mode, order in the 
>table is incorrect.
>Some advice please

The default collation table that is stored in the CDX in VFP mode can
be changed by specifying SET COLLATION before the CDX is created.
This is from the docs for CDXDBE:

 "If a collation table is selected (see SET COLLATION), it is stored 
 in the CDX file. Hence, the sorting order of characters is defined at
 index creation. This is a crucial change of the CDX file format that
 Visual FoxPro has introduced. Xbase++ supports this feature, so that
 Visual FoxPro and Xbase++ applications can share the same CDX files."
It's even possible to use a custom collation table with the
SetCollationTable() function.



Regards,
Clayton

Clayton Jones   www.cjcom.net 
 Top-Down Library for Xbase++
 X-DBU Database Utility   
 X-MEMO Memo Field Replacement
Adrian WykrotaRe: collation table in cdx file
on Tue, 27 Apr 2010 13:11:40 +0200
Maybe this help

PROCEDURE SetSystemCollation()
LOCAL aCollation[256], nAscii := 0, Licznik := 0, iMax := 0, nSortOrder := 
0, lSet := .T., aFiles := {}, cAdd := ""
LOCAL cUpperCase := "AĄBCĆDEĘFGHIJKLŁMNŃOÓPQRSŚTUVWXYZŹŻ"
LOCAL cLowerCase := "aąbcćdeęfghijklłmnńoópqrsśtuvwxyzźż"
cAdd := " 0123456789"
cUpperCase := cAdd + cUpperCase
cLowerCase := cAdd + cLowerCase
iMax := Len( cLowerCase )
AFILL(aCollation, 256)
IF xSql
  SET COLLATION TO SYSTEM
  lSet := .F.
ELSEIF cPPolUser = "MAZOVIA"
  cUpperCase := ConvStr(8, cUpperCase)
  cLowerCase := ConvStr(8, cLowerCase)
ELSEIF cPPolUser = "LATIN 2"
  cUpperCase := Txt(cUpperCase)
  cLowerCase := Txt(cLowerCase)
ELSE                                        && "ASCII"
  SET COLLATION TO AMERICAN
  lSet := .F.
ENDIF
FOR Licznik := 1 TO iMax
  nAscii := ASC(SUBSTR(cUpperCase, Licznik, 1))
  IF nAscii <> 32
    aCollation[nAscii + 1] := nSortOrder
  ENDIF
  nAscii := ASC(SUBSTR(cLowerCase, Licznik, 1))
  aCollation[nAscii + 1] := nSortOrder++
NEXT
Licznik := 0
DO WHILE  Licznik < 256 .AND. (Licznik := ASCAN(aCollation, 256, Licznik + 
1)) > 0
  aCollation[Licznik] := nSortOrder++
ENDDO
IF lset
  SET(_SET_COLLATION, aCollation)
ENDIF
RETURN


Best regards
Adrian Wykrota
Użytkownik "Atomek" <lta@logotech.com.pl> napisał w wiadomości 
news:648f4046$32c9d44d$5dd7d@news.alaska-software.com...
> Hi
>
> I move my old clipper'87 application to xbase. I have user defined 
> collation table (polish). When I create an index using the modes FOXPRO_2X 
> or index NTX everything is correct.  However, I would like to use, as is 
> recommended in the documentation, VISUAL_FOXPRO mode,  but in this mode, 
> order in the table is incorrect.
> Some advice please
>
> Tomasz Adamczyk
>
>