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 (Figure 77).


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 77: Counting Variable field in the Question Design Window’s Text Section.


A sample A2J Guided Interview with Repeat Loops is available at the bottom of the Interview Tab in A2J Author 5.0.


See also the subheading in this chapter entitled Repeat Dialogs.