Returns the number of items in a list.
Function
count(input)
Arguments
Argument | Data Type |
input | record list |
---|---|
result | integer |
Comments
Returns the number of items in a list.
Note: it is also possible to count the number of related records in a report without writing a calculation by using column totals or by summarising a report relationship.
Example
The following calculation assumes it is being run in the context of a Manager record, and it returns the number of employees that directly report to the manager.
count([Direct Reports])
Performance Tip
A common inclination is to use the count function to determine whether some particular records exists, such as: count([Assigned Tasks])>0. However, it is better to use the any function (or every function) for this type of calculation. The count function will consider (and perform security checks) on every record to calculate a count. Whereas the any function and every function are able to skip processing records once a positive (or negative) match has been found. In some cases this can lead to a considerable improvement in response times.
count([Assigned Tasks] where [Status] = 'In Progress') > 0 -- don't do this
any([Assigned Tasks].[Status] = 'In Progress') -- this gives the same result, but run more quickly