Set Value By Key Name¶
Description¶
This operation replaces the value linked to a key in the map.
Method¶
Backendless.Hive(hiveName).MapStore(keyName).set(objKey, value);
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyName |
Key name identifying a map. String value. |
objKey |
Name of the key whose value is replaced. String value. |
value |
New value for the key. Can be of any data type. |
Return Value¶
If the specified key does not exist, then this operation adds a new key-value pair to the map and returns true
. Otherwise, returns false
if a value associated with the specified key is replaced by a new value.
Example¶
The example below sets a new value 1.29
for the "Oranges"
key. This invocation returns false
indicating that the current value has been replaced.
Backendless.Hive("groceryStore").MapStore("fruits").set("Oranges", 1.29);
where:
Argument | Description |
---|---|
"groceryStore" |
Name of a hive where the operation is performed. |
"fruits" |
Key name identifying a map. |
Codeless Reference
¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a map. |
values(object) |
An object containing a new value for a key. |
Returns false
if an existing key-value pair is updated. Returns true
if a new key-value pair is added to the map.
Consider the following Map storage:
The example below sets a new value 1.29
for the "Oranges"
key. If the specified key does not exist, then a new key-value pair is added to the map.
The map will look as shown below after the Codeless logic runs: