Skip to content

Difference

Description

This operation finds the difference between the primary (first) set and all other specified sets. To find the difference, the operation subtracts identical values across multiple sets and returning the remainder (i.e. the difference) in a new set. The first set in the request is considered the main set whose remainder is left after the subtraction operation.

Method

Backendless.Hive(hiveName).SetStore.difference(keyNames): Promise<values[]>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyNames An array of keys representing set names. Keys must be of the string type.

Return Value

An array containing values retrieved after the primary and all other consecutive sets are subtracted.

Example

The example below subtracts identical values between the primary set 'cars' and the secondary set 'cars_2'. This operation returns a new set containing the remainder.

await Backendless.Hive('transport').SetStore.difference(['cars', 'cars_2'])

where:

Argument                Description
'transport' Name of a hive where the operation is performed.

Contents Of Specified Sets

set_api_example_sdks_diff_inter_union

Response


The output will look as shown below after this operation runs. Unique items(i.e. "Coupe") that are outside of the primary set("cars") are skipped.

set_api_example_sdks_diff_inter_union_output


Codeless Reference
set_api_difference

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key names A list containing key names identifying unique sets.

An array containing values retrieved after the primary and all other consecutive sets are subtracted.

Consider the following Set storages:
set_api_example_sdks_diff_inter_union

The example below subtracts items in the following sets: "cars" and "cars_2"; and gets the remainder:
set_api_example_difference

The output will look as shown below after the Codeless logic runs. Unique items(i.e. "Coupe") that are outside of the primary set("cars") are skipped.
set_api_example_sdks_diff_inter_union_output