The count()
function accepts a list argument and returns the number of elements in that list. You can also provide a condition as a second argument; if you do, count()
will return the number of elements in the list for which the condition is true.
count(list)
list.count()
count(list, condition)
list.count(condition)
Code language: JavaScript (javascript)
Much like map, filter, and other list functions, count iterates through the entire list and uses the current
keyword to represent the current element it is evaluating against the provided condition.
Example Formulas
Assume a multi-select property called “Multi-select”, where 8 entries are present on the current page:
prop("Multi-select").count() /* Output: 8 */
// Also works as:
count(prop("Multi-select"))
Code language: JavaScript (javascript)
Assume 3 entries on that page contain the letter “a”:
prop("Multi-select").count(current.contains("a"))
// Also works as:
count(prop("Multi-select"), current.contains("a"))
Code language: JavaScript (javascript)