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
parameters:
-
key — 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 — new value with which to update the previous value or create a new value.
-
type — (Optional) string indicating the datatype of value (see %DynamicObject.%Set()Opens in a new tab and %DynamicArray.%Set()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" — a JSON false (value argument must be 0) or true (value argument must be 1).
-
"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: %Get(), %Remove(), %Push(), Method Chaining
class reference: %DynamicObject.%Set()Opens in a new tab and %DynamicArray.%Set()Opens in a new tab