Choose where you’d like to start

containsKey

Overview

The containsKey function checks if a specified key or an index value is present in a collection. It returns true if the key or the index is present in the collection. Otherwise, it returns false.

Note: This function performs a case sensitive search.

Return Type

  • BOOLEAN

Syntax

To check if a key is present in a collection:

<variable> = <collectionVariable>.containsKey(<key>);

(OR)

To check if an index value is present in a collection:

<variable> = <collectionVariable>.containsKey(<index>);

where,

ParameterData typeDescription
<variable>BOOLEANVariable which will hold the returned boolean value.
<collectionVariable>

COLLECTION

The variable in which the key or the index will be looked for.

<key>

TEXT/NUMBER/DECIMAL/DATE/BOOLEAN

The key to be searched for in the collection.

<index>NUMBER

The index value to be searched for in the collection.

Examples

 productVersion = collection("Creator" : 5, "CRM" : 2, "Mail" : 8);
 info productVersion.containsKey("CRM"); // Returns true
 productVersion = collection("Creator", "CRM", "Mail");
 info productVersion.containsKey(3); // Returns false

Get Started Now

Execute