isUnique
See also: contains
$isUnique can be used to check whether a value is contained exactly once (or not at all) in a list
An optional third parameter can be used to control what should be returned in the case of "none", since this is an undefined case.
Syntax
$isUnique(source,valueToCheck[,notContainedResult=$ture[,propertyPath]])
Parameter
Name |
Description |
source |
The list or array of values. |
valueToCheck |
The value, which may occur only once in the source. |
notContainedResult |
Optional (default = $true) – specifies which value should be resolved on no occurrence. |
propertyPath |
Optional field path relative to a list entry to be able to check for the contents of an input field. |
Return value
$true if the value occurs only once in the list, or depending on parameter 3 if it does not occur in the list.
Example
Syntax |
Input value |
Result |
$isUnique($input,a) |
["a", "b", "c", "b"] |
$true |
$isUnique($input,b) |
["a", "b", "c", "b"] |
$false |
$isUnique($input,d) |
["a", "b", "c", "b"] |
$true |
$isUnique($input,d,$false) |
["a", "b", "c", "b"] |
$false |
$isUnique($input,a,value) |
[{"value": "a"}, {"value": "b"}] |
$true |