Skip to content

Add Values

Description

This operation adds new elements to a set. Duplicate values are ignored.

Method

// Check A Single Value
Backendless.Hive(hiveName).SetStore(keyName).addValue(value): Promise<boolean[]>;

// Check Multiple Values
Backendless.Hive(hiveName).SetStore(keyName).addValues(values[]): Promiseboolean[]>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a set. String value.
value A value to add to the set. The value can be of any data type.
values An array of values to add to the set. Values can be of any data type.

Return Value

Number of elements added to the set.

Example

Add a Single Value

The example below adds a new value 'SUV' to the 'cars' set.

await Backendless.Hive('transport').SetStore('cars').addValue('SUV')

where:

Argument                Description
'transport' Name of a hive where the operation is performed.
'cars' Key name identifying a set.

Add Multiple Values

The example below adds new values 'SUV'  and 'Coupe' to the 'cars' set.

await Backendless.Hive('transport').SetStore('cars').addValues(['SUV', 'Coupe'])

where:

Argument                Description
'transport' Name of a hive where the operation is performed.
'cars' Key name identifying a set.

Codeless Reference

set_api_add_items

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a set.
items A list of items to add to the set.

Returns the number of elements added to the set.

Consider the following Set storage:
set_api_example_all_blocks

The example below adds "SUV" and "Coupe" to the "cars" set:
set_api_example_add_items

The set will look as shown below after the Codeless logic runs:
set_api_example_special_blocks_1