Count
Table of Contents
Note:
- This task is applicable only to Zoho Creator.
Overview
The count function in the "aggregate records" deluge task returns the count of values(including empty strings) a specified field holds, from records fetched using a criteria.
String field types (except Users, Name, Address, and Integration) and the Radio field type, if saved without a value are stored with an empty string, and hence will return the count of the empty strings as well.
The Name and Address fields must be specified without its subfields.
Multi Select, Dropdown, Radio, and Checkbox field types will return the count of selected choices.
When the field is not specified, it simply returns the count of fetched records.
The criteria is mandatory.
Return
The data-type of the returned value is Number.
Syntax
<variable> = <form_link_name> [<criteria>].count(<field_link_name>);
Parameter | Description | |
---|---|---|
<variable> | Variable which will hold the returned value. | |
<form_link_name> | Link name of the form from which the records will be fetched. | |
<criteria> | Criteria based on which the records will be fetched. | |
count(<field_link_name>) | Link name of the field to which the count function will be applied. This function can be applied to any Zoho Creator field type. The <field_link_name> param is optional. |
Things to keep in mind
- If you wish to fetch all records of the specified form, use the following script as criteria:[id != 0]
It is advisable to fetch all records only when absolutely needed. Fetching all records generates a load resulting in performance issues.
This task can be used in the following events
When a record is Created | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Created or Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Deleted | ||
On Validate | Yes | |
On Success | Yes | |
Other workflow events | ||
On a scheduled date | Yes | |
During approval process | Yes | |
During payment process | Yes | |
In a Custom Function | Yes | |
In an Action item in report | Yes |
Example
The following script returns the count of values of "phone number" field from the Employees form.