xsharp.eu • SetCollation of Index
Page 1 of 1

SetCollation of Index

Posted: Wed May 11, 2022 9:29 am
by hilberg.it
Hi,

I am need to set the collation of one or all indices to "oem:de_DE" in ADS Server. This can be done manually through the Advantage Data Architect using Table Designer in the additional index definitions. But can I somehow set this property already in my code that reindexes my tables?

The code starts with something like this

Code: Select all

SetCollation(#CLIPPER)
SetAnsi(false)
SetInternational (#CLIPPER)
SetDecimalSep  (Asc(","))
SetThousandSep (Asc("."))
SetDateCountry(GERMAN)
SetEpoch(1990)
SetCentury(true)
SetExclusive(FALSE)
SetDeleted(true)
Enable3dControls ()
RDDSETDEFAULT("AXDBFCDX")
Later I call "DbReindex()" which will create my CDX files.
Could I use "AX_SetCollation("...")" or change "SetCollation(#CLIPPER)" to "oem:de_DE"?

Thanks

SetCollation of Index

Posted: Wed May 11, 2022 11:55 am
by robert
You can indeed use AX_SetCollation() to set a new collation for the next table open or table creation operation.
The function returns the previous setting.
The setting is stored in the X# runtime state and used by the ADS RDDs.
Please note that X# uses the same collation for all indexes by default.
With some hacking you could probably access and change the (internal) _Collation field in the ADS RDD object and change it between the creation of different indices.
If you add an enhancement request in our GitHub repo I can also try to add a way to change that using the DbInfo() function for a next build.


Robert

SetCollation of Index

Posted: Wed May 11, 2022 12:47 pm
by hilberg.it
Thanks Robert, sounds promising. Do you know what are valid arguments for AX_SetCollation()? I tried using "oem" and "oem:de_DE", but couldn't see any effect in Advantage Data Architect.

SetCollation of Index

Posted: Wed May 11, 2022 3:58 pm
by robert
I would advise to check the ADS documentation for this.
We are passing the string literally to ADS

Robert

SetCollation of Index

Posted: Wed May 11, 2022 10:49 pm
by g.bunzel@domonet.de
Hope that helps:
https://devzone.advantagedatabase.com/d ... lation.htm

Description

This function specifies which collation language to use when opening tables, opening cursors, or creating tables. By default, no collation language is set and the client will use the language set by the Advantage Database Server.

Note Collation languages are only valid with ADT and VFP tables. For all other table types, the collation language is ignored.


HTH

Gerhard