1. Docs
  2. Formulas
  3. Functions

TALLY

Counts the occurrences of each unique element within an array, accounting for case sensitivity.

Categories: Arrays

Syntax

TALLY(array, [strict_types: FALSE])

Examples

Example 1

Input

1
{
2
"my_action": {
3
"message": [
4
"dog",
5
"dog",
6
"cat",
7
"cat",
8
"cat",
9
"fish"
10
]
11
}
12
}

Formula

TALLY(my_action.message)

Output

1
{
2
"dog": 2,
3
"cat": 3,
4
"fish": 1
5
}

Example 2

Input

1
{
2
"my_action": {
3
"message": [
4
404,
5
404,
6
"404",
7
505,
8
"505"
9
]
10
}
11
}

Formula

TALLY(my_action.message, strict_types: TRUE)

Output

1
[
2
{
3
"key": 404,
4
"count": 2
5
},
6
{
7
"key": "404",
8
"count": 1
9
},
10
{
11
"key": 505,
12
"count": 1
13
},
14
{
15
"key": "505",
16
"count": 1
17
}
18
]

Sample actions

Event Transform
My Action
Event Transform
TALLY

Select an action to inspect

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?
TALLY | Docs | Tines