Append a new value to the end of the current array, increasing the length of the array. Returns an oref pointing to the current modified array so that calls to %Push() can be chained. See “Using %Push and %Pop with Dynamic Arrays” for details and examples.
method %Push(value, type) as %DynamicAbstractObject
parameters:
-
value — value to be assigned to the new array element.
-
type — (Optional) string indicating the datatype of value (see %DynamicArray.%Push()Opens in a new tab for details on how values are converted). The following strings may be used:
-
"null" — a JSON null. The value argument must be "" (empty string).
-
"boolean" — zero/nonzero becomes JSON false/true
-
"number" — convert value to a canonical numeric value
-
"string" — convert value to a text string
-
"string>base64" — convert to text string then encode into base64
-
"string<base64" — convert to text string then decode from base64
-
"stream" — %Stream contents converted to text string
-
"stream>base64" — %Stream contents are encoded into base64 string
-
"stream<base64" — %Stream is decoded from base64 into byte string
NOTE: The optional type parameter cannot be used if the specified value is an object or an oref. For example, if the specified value is a dynamic entity, an error will be thrown no matter what value you specify for type. See “Overriding a Default Datatype with %Set() or %Push()” for more information.
see also: %Pop(), %Set(), Method Chaining
class reference: %DynamicArray.%Push()Opens in a new tab