Home > Class Reference > ENSLIB namespace > %Library.DynamicObject
Private  Storage   

%Library.DynamicObject


class %Library.DynamicObject extends %Library.DynamicAbstractObject

Dynamic Object type class.

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
5


Summary


Methods
%Get %GetIterator %IsDefined %Remove %Set


Methods


• method %Get(key) as %CacheString
Given the key value of a key/value pair in an object, return the actual value that corresponds to the key value. If the value does not exist, a null string "" is returned. You can differentiate between an unassigned value that returns a "" string and a real "" string using %GetTypeOf().

key The key name of the value you wish to retrieve

Returns The value of the data as defined by key. If the value does not exist, a null string "" is returned. You can differentiate between an unassigned value that returns a "" string and a real "" string using %GetTypeOf()

• method %GetIterator() as %Iterator.Object

Perform an iteration of all the values in a %DynamicAbstractObject subclass.

In the example below, we will output all values contained in a %DynamicObject.

	   set iter = obj.%GetIterator()
	   while iter.%GetNext(.key , .value ) {
	      write "key = "_key_" , value = "_value,!
	   }
• method %IsDefined(key) as %Boolean
Tests if a key is defined within an object.

key The key name of the value you wish to test

Returns A boolean value to show if a value is defined (1) or not (0).

• method %Remove(key) as %DynamicAbstractObject
Remove the element with the named key from the %DynamicObject. If the value of the element is an embedded %DynamicArray or %DynamicObject, remove all subordinate nodes as well.

key The key name of the %DynamicObject element you wish to remove

Returns The value of the removed %DynamicObject element

• method %Set(key, value, type) as %DynamicAbstractObject
Create a new value or update an existing value.

key The key name of the value you wish to create or update.

value The new value with which to update the previous value or create a new value.

type OPTIONAL, the type of the value being assigned.

If the type argument is present then it must be one of the following strings:
"null" - JSON null, must be ""
"boolean" - Either 0 or nonzero integer
"number" - Convert to numeric value
"string" - Convert to text string

Returns An object to the current modified object, allowing calls to set() to be nested.