CheckFieldUniqueness Component

Overview

The CheckFieldUniqueness method can be used to test the uniqueness of a targetEntity's field against the entities in the target entity space.


# field: string of the field
# entitiesToTest: collection of targetEntities
FieldUniquenessResult function CheckFieldUniqueness(field, entitiesToTest)

FieldUniquenessResult

The CheckFieldUniqueness returns an object called FieldUniquenessResult which contains the results of the uniqueness test. FieldUniquenessResult contains the following attributes:

Attributes Description Access Via
Uniques A collection of target entities that passed the uniqueness check $uniques = $result.Uniques;
LocalNonUniques A collection of target entities that failed the uniqueness check against another entity in the tested collection $localNonUniques = $result.LocalNonUniques;
ContextNonUniques A collection of target entities that failed the uniqueness check against an entity in the target entity space. $contextNonUniques = $result.ContextNonUniques;

Examples


$report = $components.CheckFieldUniqueness("uniqueId", $targetEntities);
# Entities with unique value for 'uniqueId' field
$uniqueEntities = $report.Uniques;
# Entities with a non-unique value for 'uniqueId' field compared against other entities in $targetEntities
$locallyNonUniques = $report.LocalNonUniques;
# Entities with a non-unique value for 'uniqueId' field compared against other entities already in the target entity space
$contextNonUniques = $report.ContextNonUniques;

Is this article helpful for you?