Skip to main content

%Library.String

Class %Library.String Extends %DataType [ System = 1 ]

The %String data type class represents a string.

The logical value of the %String data type is a string.

Parameters

COLLATION

Parameter COLLATION [ Constraint = ",ALPHAUP,EXACT,MINUS,MVR,PLUS,SPACE,COLLATE,SQLSTRING,SQLUPPER,STRING,TRUNCATE,UPPER,", Flags = ENUMEDIT ];

The default collation value used for this data type. Note that if you specify a truncation length and also a VALUELIST then your truncation length must be longer or equal to your longest VALUELIST value

MAXLEN

Parameter MAXLEN As INTEGER = 50;

The maximum number of characters the string can contain.

MINLEN

Parameter MINLEN As INTEGER;

The minimum number of characters the string can contain.

PATTERN;

Parameter PATTERN;

A pattern which the string should match.

The value of PATTERN should be a valid ObjectScript pattern match expression.

TRUNCATE

Parameter TRUNCATE As BOOLEAN = 0;

Determines whether to truncate the string to MAXLEN characters.

VALUELIST;

Parameter VALUELIST;

Used for enumerated (multiple-choice) attributes. VALUELIST is either a null string ("") or a delimiter separated list (where the delimiter is the first character) of logical values. If a non-null value is present, then the attribute is restricted to values in the list, and the validation code simply checks to see if the value is in the list.

DISPLAYLIST;

Parameter DISPLAYLIST;

Used for enumerated (multiple-choice) attributes. Used in conjunction with the VALUELIST parameter for enumerated (multiple-choice) attributes. DISPLAYLIST, if not null, represents the display values for the attribute corresponding with the logical values listed in VALUELIST.

The display values are returned by the LogicalToDisplay method.

JSONLISTPARAMETER;

Parameter JSONLISTPARAMETER;

Used to specify the name of the parameter which contains the enumeration list for JSON values. The parameter which contains the list must be in the format used for VALUELIST and DISPLAYLIST. The default is VALUELIST.

XMLLISTPARAMETER;

Parameter XMLLISTPARAMETER;

Used to specify the name of the parameter which contains the enumeration list for XML values. The parameter which contains the list must be in the format used for VALUELIST and DISPLAYLIST. The default is VALUELIST.

CONTENT

Parameter CONTENT [ Constraint = "MIXED,STRING,ESCAPE,ESCAPE-C14N", Flags = ENUM ] = "STRING";

XML element content "MIXED" for mixed="true" and "STRING" or "ESCAPE" for mixed="false". If CONTENT="STRING" (default) XML special characters are put in a CDATA section during XML export. If CONTENT="ESCAPE" XML special characters are escaped during XML export. If CONTENT="ESCAPE-C14N" XML special characters are escaped during XML export using the translate table, XMLC, specified for XML Canonicalizaton. The main difference is that CR is escaped as

ESCAPE

Parameter ESCAPE [ Constraint = "HTML,XML", Flags = ENUM ] = "XML";

Controls the translate table used to escape content when CONTENT="MIXED" is specified.

XSDTYPE

Parameter XSDTYPE = "string";

Declares the XSD type used when projecting XML Schemas.

JSONTYPE

Parameter JSONTYPE = "string";

JSONTYPE is JSON type used for this datatype.

Methods

XSDToLogical

ClassMethod XSDToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ]

If XMLLISTPARAMETER is specified, XSDToLogical is generated which imports using the list specified by XMLLISTPARAMETER.

LogicalToXSD

ClassMethod LogicalToXSD(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ]

If XMLLISTPARAMETER is specified, XSDToLogical is generated which exports using the list specified by XMLLISTPARAMETER.

JSONToLogical

ClassMethod JSONToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ]

If JSONLISTPARAMETER is specified, XSDToLogical is generated which imports using the list specified by JSONLISTPARAMETER.

LogicalToJSON

ClassMethod LogicalToJSON(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ]

If JSONLISTPARAMETER is specified, XSDToLogical is generated which exports using the list specified by JSONLISTPARAMETER.

DisplayToLogical

ClassMethod DisplayToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 0 ]

Converts the input value %val, which is a string, into the logical string format. Returns the logical value of the input string %val.

Normalize

ClassMethod Normalize(%val As %RawString) As %String [ CodeMode = generator, ServerOnly = 1 ]

Truncates value %val to MAXLEN, characters.

IsValid

ClassMethod IsValid(%val As %RawString) As %Status [ CodeMode = generator, ServerOnly = 0 ]

Tests if the logical value %val, which is a string, is valid. The validation is based on the class parameter settings used for the class attribute this data type is associated with. In this case, MINLEN, MAXLEN, VALUELIST, and PATTERN.

LogicalToDisplay

ClassMethod LogicalToDisplay(%val As %String) As %String [ CodeMode = generator, ServerOnly = 0 ]

Converts the value of %val, which is in logical format, into a display string. Removes all the null characters from the string.

Returns the string value of %val.

LogicalToOdbc

ClassMethod LogicalToOdbc(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ]