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.

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
Sync-Time Custom Record Fields Compatible

Can be used to create a custom record field that only evaluates at sync time.

Real-Time Custom Record Fields Incompatible
Process Reports Compatible
Process Events Compatible
Open in Github Built: Fri, May 24, 2024 (06:17:48 PM)

contains() Function