COUNTIF

Returns the count of all elements in an array that are equal to the comparison argument.

Syntax 

COUNTIF(array, comparison)

Examples 

Example 1

Input

{
  "my_action": {
    "message": [
      "north",
      "south",
      "east",
      "west",
      "north"
    ]
  }
}

Formula

COUNTIF(my_action.message, "north")

Output

2
Example 2

Comparison can also be a lambda.

Input

{
  "my_action": {
    "message": [
      {
        "count": 6
      },
      {
        "count": 2
      },
      {
        "count": 1
      },
      {
        "count": 3
      }
    ]
  }
}

Formula

COUNTIF(my_action.message, LAMBDA(item, item.count > 1))

Output

3