Skip to main content
Version: v0.17.0

ArrayDistinct

Alias:ArrayDistinct, Distinct, RemoveDuplicates

Output:Array of T

Removes duplicate elements in an array or entities in an entity stream. By default, all entity properties are used to determine duplicates. This behaviour can be changed by using the KeySelector parameter.

ParameterTypeRequiredPositionDefault ValueSummary
Array
In
array<T>1The array to sort
KeySelector
Using
T2The item/entityA function that gets the key to distinct by from the variable To distinct by multiple properties, concatenate several keys
IgnoreCasebool3FalseWhether to ignore case when comparing strings.

Examples

Example 1

SCL

[1, 2, 2, 3, 3] | RemoveDuplicates

Expected Output

[1, 2, 3]

Example 2

SCL

[('a': 1 'b': 2), ('a': 1 'b': 2), ('a': 3 'b': 4)] | ArrayDistinct

Expected Output

[('a': 1 'b': 2), ('a': 3 'b': 4)]