Determine Number of True Responses in a Repeated Dialog

From HotDocs Wiki

Jump to: navigation, search

In a repeated dialog, you may use a True/False variable to gather information about each set of answers. For example, a dialog containing a list of children may include a True/False variable to indicate which children are minors. Later, you may want to know how many of the children are minors.

You can use the following computation to count the number of true responses in a repeated dialog. At the beginning of the computation, the Number variable used to store the number of true responses is initialized to a value of zero. Then, as the dialog is repeated, this number is incremented each time a true answer is found.

Examples

Example 1: For any version of HotDocs

SET Num Var TO 0 
REPEAT Repeat Dialog 
  IF TrueFalse Var 
    SET Num Var TO Num Var + 1 
  END IF  
END REPEAT

Example 2: Only for HotDocs 6.2 or later (uses INCREMENT)

SET Num Var TO 0 
REPEAT Repeat Dialog
  IF TrueFalse Var 
    INCREMENT Num Var         
  END IF  
END REPEAT
Repeat Dialog Any repeated dialog.
TrueFalse Var Any True/False variable in a repeated dialog (Repeat Dialog).
Num Var A Number variable used to store the number of true responses for TrueFalse Var.