Add Last¶
Description¶
This operation adds new values to the very end of a list.
Method¶
Add a Single Value
Backendless.Hive(hiveName).ListStore(keyName).addLastValue(value): Promise<number>;
Add Multiple Values
Backendless.Hive(hiveName).ListStore(keyName).addLastValues(values): Promise<number>;
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyName |
Key name identifying a list. String value. |
value |
Value to add to the list. Can be of any JavaScript data type. |
values |
An array of values to add to the list. Individual values can be of any JavaScript data type. |
Return Value¶
The number of values in the list after the new values are saved.
Examples¶
Add a Single Value
The example below adds the new value 'Grapes'
to the very end of the 'fruits'
list.
await Backendless.Hive('demoHive').ListStore('fruits').addLastValue('Grapes')
where:
Argument | Description |
---|---|
'demoHive' |
Name of a hive where the operation is performed. |
'fruits' |
Key name identifying a list. |
Add Multiple Values
The example below adds two values 'Bananas'
and 'Mangoes'
to the very end of the 'fruits'
list.
await Backendless.Hive('demoHive').ListStore('fruits').addLastValues(['Bananas', 'Mangoes'])
where:
Argument | Description |
---|---|
'demoHive' |
Name of a hive where the operation is performed. |
'fruits' |
Key name identifying a list. |
Codeless Reference
¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a list. |
items |
A list of new items to add to the list. |
position: last |
Instructs Hive to add the new values at the end of the list. |
Returns the number of values in the list after the new values are saved.
Consider the following List storage:
The example below adds "Bananas"
and "Mangoes"
to the end of the "fruits"
list:
The list will look as shown below after the Codeless logic runs: