Counting Variables

(last updated March 2020)

Counting Variables

A2J Author® allows authors to repeat (or loop) a Question or series of Questions in order to collect multiple values for similar types of information (e.g., names and amounts of assets, names and birthdates of all children, etc.)  The program does this by associating a Counting Variable with a Repeat Dialog. A Counting Variable is associated with a Question by entering the name of the Counting Variable in the field provided under the Question Tab (see figure below).


The Counting Variable keeps track of the number of times the Repeat Dialog (or Loop) has been repeated. The number associated with a particular loop constitutes the value of the Counting Variable. That value is then appended to each variable name used in a Question which is part of that loop.


For example, in a Repeat Dialog which collects the names of children under a variable entitled “Child name first TE” and uses a Counting Variable entitled “ChildCount,” the variable name will be appended each time with the following: “#ChildCount.” If the Repeat Dialog were repeated three (3) times (because there happened to be three (3) children), the variable names for the each child’s first name would look like the following: Child name first TE#1, Child name first TE#2, and Child name first TE#3.


Repeat Loop Counting Variable field.png

Figure: Counting Variable field in the Question Design Window’s Question Info Section.


To practice your repeat loop skills and see counting variables in practice, check out the Sample Exercise: Sample A2J Guided Interview and A2J DAT Text Template: Repeat Loops


See also the subheading in this chapter entitled Repeat Dialogs.