contains

Prev Next

See also: findFirst, findAll (Find values in lists), isUnique

The $contains function can be used to check whether a value appears at least once in a list.

Tooltip

Syntax: $contains(source,valueToCheck)

Parameter

Description

source

The list or array of values.

valueToCheck

The value, which may occur only once in the source.

If the value is found, true is returned, otherwise false.

Example: $contains($el(12,true),Needle) – Searches the word 'Needle' in a list of text field values.

Syntax

$contains(source,valueToCheck)

Parameter

Name

Description

source

The list or array of values.

valueToCheck

The value, which may occur only once in the source.

propertyPath

Reads the value to compare from a field path specified here, relative to a list entry (optional).

Return value

Returns $true if the value occurs at least once in the list.

Example

Syntax

Input value

Result

$contains($input,a)

["a", "b", "c", "b"]

$true

$contains($input,b)

["a", "b", "c", "b"]

$true

$contains($input,d)

["a", "b", "c", "b"]

$false

$contains($el(12,true),{value})

$el(12,true) returns all values of all repetitions of the element with ID 12. {value} returns a value that will be passed in case of a triggered behavior.

$contains({users},admin,username)

Searches a list of users for one with the username 'admin' (field to search: username).