SetCollation of Index

This forum is meant for questions and discussions about the X# language and tools
Post Reply
hilberg.it
Posts: 75
Joined: Sun Sep 20, 2020 7:25 am
Location: Germany

SetCollation of Index

Post 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
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SetCollation of Index

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
hilberg.it
Posts: 75
Joined: Sun Sep 20, 2020 7:25 am
Location: Germany

SetCollation of Index

Post 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.
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SetCollation of Index

Post by robert »

I would advise to check the ADS documentation for this.
We are passing the string literally to ADS

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
g.bunzel@domonet.de
Posts: 97
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

SetCollation of Index

Post 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
Post Reply