Skip to main content

Defining Collection Properties

Defining Collection Properties

To define list or array properties, use these property definition syntaxes:

Property MyProp as list of Type;
Property MyProp as array of Type;

Here, MyProp is the property name, and Type is either a data type class or an object class.

This example shows how to define a property for a list of %StringOpens in a new tab values.

Property Colors as list of %String;

This code shows how to define a property for an array of Doctor objects.

Property Doctors as array of Doctor;

InterSystems IRIS stores collection properties as instances of classes in the %Collection package. These classes contain the methods and properties that you can use to work with collections.

This table summarizes the ways to define collection properties and the %Collection classes used to store them.

Collection Type %Collection Class

List of strings, integers, or other data type

%Collection.ListOfDTOpens in a new tab

List of objects

%Collection.ListOfObjOpens in a new tab

Array of strings, integers, or other data type

%Collection.ArrayOfDTOpens in a new tab

Array of objects

%Collection.ArrayOfObjOpens in a new tab
Note:

Do not use the %Collection classes directly as the type of a property. For example, do not create a property definition like this:

Property MyProp as %Collection.ArrayOfDT;

FeedbackOpens in a new tab