25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Properties<br />

You can manipulate a collection property using the methods of the collection object associated<br />

with it. For example, you can perform operations on the Colors property defined earlier, using<br />

the methods provided by the %ListOfDataTypes class:<br />

Do obj.Colors.Insert("Red")<br />

Do obj.Colors.Insert("Green")<br />

Do obj.Colors.Insert("Blue")<br />

7.5.4 Stream Properties<br />

Streams are used to create properties containing large (greater than 32K) amounts of character<br />

or binary data. Binary streams contain the same sort of data as type %Binary, and can hold<br />

large binary objects such as pictures. Character streams contain the same sort of data as type<br />

%String, and are intended for storing large amounts of text. Stream data can be stored in either<br />

an external file or a global, depending on how the property is defined. For example, the following<br />

code defines a binary stream stored as a file, and a character stream stored as a global<br />

(the LOCATION parameter is optional):<br />

Property Image As %FileBinaryStream(LOCATION = "C:/Images");<br />

Property Text As %GlobalCharacterStream(LOCATION = "^MyText");<br />

Streams provide numerous methods for manipulating the data they contain. See the Streams<br />

chapter for more detailed information.<br />

7.5.5 Multidimensional Properties<br />

Properties can be marked as being multidimensional. This gives the instance variable associated<br />

to the property all the characteristics of an array node, upon which array operations like<br />

$ORDER could work. For instance:<br />

Property abc [ MultiDimensional ];<br />

Property abc As %String [ MultiDimensional ];<br />

The following are examples of available operations on abc:<br />

Set x = $DATA(obj.abc)<br />

Set x = $DATA(obj.abc(3))<br />

Set x = $GET(obj.abc(3))<br />

Set x = $ORDER(obj.abc("hello",3))<br />

KILL obj.abc<br />

The property behavior and data type classes are not used to generate methods for multidimensional<br />

properties. Thus, a multidimensional property named Kids has no KidsGet, KidsSet,<br />

or KidsLogicalToDisplay methods. There is no validation on setting a property value.<br />

52 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!