Free cookie consent management tool by TermsFeed contains() Function
contains() Function

Function

contains( array, value )

Checks whether an array contains the value.

Parameters

Keyword Type Description

array

Any Type Array

Array to check.

value

Any Type

Value to look for.

Returns

Boolean

Examples

contains({1, 2, 3}, 2) returns true

Check whether a text value is in an array

Values are matched case sensitively:

contains({"A", "b", "c"}, "A") returns true
contains({"A", "b", "c"}, "a") returns false

Check whether an integer value is in a decimal array

contains({1, 2.2, 3.3}, todecimal(1)) returns true

Cast the integer value to a decimal using the todecimal() function so that the two inputs are of the same type. Not doing so results in the error message Invalid types, can only act on data of the same type.

Check whether a null value is in an array

contains({1, null, 3}, tointeger(null)) returns true

When the value is an empty list of the same type, true is returned:

contains({1, 2, 3}, tointeger({})) returns true
contains(tointeger({}), tointeger({}) returns true

Check whether an array of values are all contained in the array

contains({1, 2, 3}, {1, 2}) returns true
contains({1, 2, 3}, {1, 4}) returns false

To return the indices where the values match, use wherecontains():

wherecontains(2, {1, 2, 3}) returns an array with 2

Check whether a dictionary or CDT value is in an array

All fields of the dictionary must match the fields of one of the values in the array:

contains({{a: 1, b: 2}, {a:3, b: 4}}, {a:1, b: 2}) returns true
contains({{a: 1, b: 2}, {a:3, b: 4}}, {a:1}) returns false
contains({{a: 1, b: 2}, {a:3, b: 4}}, {a: "1", b: 2}) returns false

Feature compatibility

The table below lists this function's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Mobile Compatible
Custom Record Field Expressions Compatible
Process Reports Compatible
Process Events Compatible
Open in Github Built: Fri, Feb 23, 2024 (09:12:49 PM)

contains() Function

FEEDBACK