Skip to main content

%Library.ArrayOfDataTypes

Class %Library.ArrayOfDataTypes Extends (%Collection.AbstractArrayOfDT, %SerialObject) [ ClassType = serial, OdbcType = VARCHAR, StorageStrategy = Custom, System = 2 ]

For information on this class, see Working with Collections.

The %ArrayOfDataTypes class represents an array of literal (i.e., data type) elements, each of which is associated with a unique key value. Keys can have any value, string or numeric.

Refer to %Collection.AbstractArray for a description of the various array methods. These classes can be used 'standalone' to store a collection.

Parameters

ELEMENTTYPE

Parameter ELEMENTTYPE = "%String";

The type (class name) of the elements stored in the collection.

Properties

ElementType

Property ElementType As %String(MAXLEN = 256) [ InitialExpression = {..#ELEMENTTYPE} ];

The type (classname:propertyname) of the elements stored in the collection.

Data

Property Data As %String [ MultiDimensional ];

Data is a private property used to hold the contents of the array.

Methods

Clear

Method Clear() As %Status

Clears the contents of the array.

Returns a %Status value indicating success or failure.

Count

Method Count() As %Integer [ ProcedureBlock = 1 ]

Returns the number of elements contained in the array.

IsDefined

Method IsDefined(key As %String) As %Boolean [ CodeMode = expression, Final ]

Returns true (1) if a value is defined at location key, otherwise false (0).

Define

Method Define(key As %String) As %Boolean [ CodeMode = expression, Final ]

This method is deprecated.

Please use IsDefined instead.

Find

Method Find(element As %String, key As %String) As %String

Starting from, but not including, location key, finds the next element in the array with value equal to element.

If key is a null string (""), the search starts at the beginning of the array.

Find returns the key associated with the found element or null string ("") if no element is found.

GetNext

Method GetNext(ByRef key As %String) As %String

Finds and returns the value of the element at the location after key in the array. If key is a null string (""), it returns the value of the first element in the array.

The value of key, which is passed by reference, is updated to the key value of the returned element or null string ("") if key is at the end of the array.

GetPrevious

Method GetPrevious(ByRef key As %String) As %String

Finds and returns the value of the element at the location before key in the array. If key is a null string (""), it returns the value of the last element in the array.

The value of key, which is passed by reference, is updated to the key value of the returned element or null string ("") if key is at the beginning of the array.

Next

Method Next(key As %String = "") As %String [ CodeMode = expression, Final ]

Finds and returns the key value of the element at the location following key in the array. If key is a null string (""), then Next returns the key value for the first element in the array.

Previous

Method Previous(key As %String = "") As %String [ CodeMode = expression, Final ]

Finds and returns the key value of the element at the location preceding key in the array. If key is a null string (""), then Next returns the key value for the last element in the array.

RemoveAt

Method RemoveAt(key As %String) As %String

Removes the element associated with key in the array.

RemoveAt returns the value of the removed element or null string ("") if no element was removed.

SetAt

Method SetAt(element As %String, key As %String) As %Status

Sets the value of the element associated with key to element.

Returns a %Status value indicating success or failure.

%ValidateObject

Method %ValidateObject(force As %Integer) As %Status

BuildValueArray

ClassMethod BuildValueArray(serialized As %Binary, array As %Binary) As %Status

Constructs array(key)=value for each element in the serialval value.

Returns a %Status value indicating success or failure.

GetAt

Method GetAt(key As %String = "") As %String [ CodeMode = expression, Final ]

Finds and returns the value of the element associated with key.

GetAt returns the value of the element associated with key or null string ("") if no element is found.

%GetSerial

Method %GetSerial(force As %Integer = 0) As %String [ Private ]

%SetSerial

Method %SetSerial(serialized As %String) As %Status [ Private ]

LogicalToOdbc

ClassMethod LogicalToOdbc(val As %String = "") As %String

Converts the serial state of this array object to a delimited string using the value of the ODBCDELIMITER parameter as a delimiter.

OdbcToLogical

ClassMethod OdbcToLogical(val As %String = "") As %String

Converts the value of an incoming delimited string to a serialized state using the value of the ODBCDELIMITER parameter as a delimiter.