Skip to main content

%Library.CollationGenerator

class %Library.CollationGenerator

This class implements expression generators for all collations.

A collation expression is used by code generators to tranform logical data values into values used by indices.

For example, you may wish that a query by name finds the same results for both "ELVIS" and "elvis". Using a case-insensitive index transformation, such as String, will accomplish this. If you want an exact match, use Exact.

Collations are specified via a property's COLLATION parameter. Every datatype has a default COLLATION value, which matches one of the methods of the %Collation class. The COLLATION parameter can be overwritten by an individual property or by a specific index definition.

Note that changing a property's COLLATION value will corrupt any index values currently stored for that property and will require you to manually repopulate the index.

Method Inventory

Methods

classmethod CollateCodeGen(val As %String, transSpec As %String = "", length As %String = "") as %String
Generate collation expression for COLLATE collation
classmethod CollationExpression(collation As %String = "", %val As %String, parms As %String) as %String
This method generates the appropriate collation expression as requested by the parameters. collation =

AlphaUp Converts a logical value to upper case, strips all punctuation and white space (except for ',' and '?').

This method is included for compatability with earlier products; use String instead.

Exact Performs no transformation; the index value is exactly the logical value.

Minus Prepends a minus ('-') sign to the logical value.

This method is included for compatability with earlier products; you should not need it in new applications.

MVR MULTI VALUE Collation

Plus Prepends a plus ('+') sign to the logical value.

This method is included for compatability with earlier products; you should not need it in new applications.

Space Prepends a space (' ') character to the logical value.

This method is included for compatability with earlier products; you should not need it in new applications.

SqlString Prepends a space to force string collation and strips trailing whitespace.

This method is used to insure that strings are collated case-sensitively and that numeric string values are collated correctly.

SqlUpper Converts a logical value to upper case, strips trailing whitespace and prepends a space to force string collation.

This collation is used to insure that strings are collated case-insensitively and that numeric string values are collated correctly.

String Converts a logical value to upper case, strips all punctuation and white space (except for ',').

Truncate Performs no transformation; the index value is exactly the logical value. However, the value will be truncated to the length specified by the optional length argument. Truncate with no length is the same as Exact.

Upper Converts a logical value to upper case without removing any characters.

%val the expression being collated

parms collation parameters as expected by collation

classmethod IsValid(collation As %RawString = "")
classmethod Nulls(collation As %String = "", collationparms As %String = "") as %Boolean
FeedbackOpens in a new tab