COUNT Function

The COUNT function counts either the number of options a template user selects for a specific Multiple Choice variable; or it counts the answers a template user provides for the repeated dialog you specify.

The difference between COUNT and COUNTER is that COUNT counts the number of repetitions in a list, while COUNTER gives you the number (index) of the current repetition.

You can use the COUNT function with either a Multiple Choice variable or a repeated Dialog to insert appropriate language, control interview flow, or otherwise determine a template's logic.

Function name COUNT
Usage model COUNT ( MULT_CHOICE_VAR, DIALOG )
Parameters The COUNT function requires you to replace one of two parameters:

MULT_CHOICE_VAR

The function evaluates the number of options the user has selected for a Multiple Choice variable.

DIALOG

The function evaluates the number of answers the user has provided for a repeated Dialog
Result A number value

Example

Suppose you want your template to insert either the plural or singular version of a word. You could use COUNT to do that for you as follows:

IF COUNT ( item ) = 1
   "Item"
ELSE IF COUNT ( item ) > 1
   "Items"
END IF 

Download

After you download the example template, you can import the template to any workspace to see this example code in action.