This section lists all available dynamic entity methods, briefly describing each one and providing links to further information. All methods are available for both objects and arrays, with the exception of %Push() and %Pop(), which apply only to arrays.
Given a valid object key or array index, returns the value. If the value does not exist, a null string "" is returned. See Using %Set(), %Get(), and %Remove() for details and examples.
key the object key or array index of the value to be retrieved. An array index must be passed as a canonical integer value. Array indexes begin at position 0.
This is a method of the %Iterator object returned by %GetIterator(). It advances the iterator and returns true if the iterator is positioned on a valid element, false if it is beyond the last element. The key and value arguments return values for a valid element at the current iterator position. See Iterating over a Dynamic Entity with %GetNext() for details and examples.
method getNext(Output key, Output value) as %Integer
Tests if the item specified by key is defined within an object. Returns false if the item is unassigned or does not exist. See Using %IsDefined() to Test for Valid Values for details and examples.
key the object key or array index of the item to be tested. An array index must be passed as a canonical integer value. Array indexes begin at position 0.
Returns the value of the last member of the array. The value is then removed from the array. If the array is already empty, the method returns the empty string, "". See Using %Push and %Pop with Dynamic Arrays for details and examples.
Given a new value, append it to the end of the current array, increasing the length of the array. value Returns An oref referencing the current modified array, allowing calls to %Push() to be chained. See Using %Push and %Pop with Dynamic Arrays for details and examples.
method %Push(value, type) as %DynamicAbstractObject
Removes the specified element from a dynamic object or array, and returns the value of the removed element. If the value of the element is an embedded dynamic object or array, all subordinate nodes are removed as well. In a dynamic array, all elements following the removed element will have their subscript position decremented by 1. See Using %Set(), %Get(), and %Remove() for details and examples.
key the object key or array index of the element you wish to remove. An array index must be passed as a canonical integer value. Array indexes begin at position 0.
Create a new value or update an existing value. Returns a reference to the modified array, allowing calls to %Set() to be nested. See Using %Set(), %Get(), and %Remove() for details and examples.
method %Set(key, value, type) as %DynamicAbstractObject
key the object key or array index of the value you wish to create or update. An array index must be passed as a canonical integer value. Array indexes begin at position 0.
value The new value with which to update the previous value or create a new value.
type optional string indicating the datatype of value. The following strings may be used:
Returns an integer showing the size of a dynamic object or array. In the case of an array, the size includes unassigned entries within the array. In the case of an object, the size only includes elements that have assigned values. See Sparse Array Iteration with %Size() for details and examples.
If outstrm is an object but is not an instance of %Stream.Object then an exception will be thrown.
If outstrm is not an object and is not null then it is presumed to be a fully qualified file specification (the full path to the file must be defined). The file is linked to a newly created %Stream.FileCharacter stream, the JSON string is written to the stream, and the stream is saved to the file on completion.