Lesson 15: Create Lists of Answers
Overview
Sometimes when completing an interview, you need to enter two or more answers for a given question. These answers generate a list within the document. For example, perhaps you need to include the names of several customers, rather than just a single customer. To accomplish this, you can repeat the Customer Name variable. This allows the user to enter as many answers as necessary and each name will be merged.
In this lesson, you will use a REPEAT instruction to create a list of colleges the employee has attended. You will repeat an entire paragraph of text as well as just a portion of an existing paragraph. In a later lesson, you will also learn how to repeat rows in a word processor table.
Start the Tutorial
If you are continuing immediately from Lesson 14, skip the instructions for opening the template and proceed to “ Repeat a Paragraph.”
If you closed the template at the end of Lesson 14, complete the following steps.
To open the tutorial template
- Open your word processor and click the
HotDocs button, located on your word processor’s toolbar. The My Test Templates library appears.
If the My Test Templates library does not appear, choose Open Library (File menu), select the library in the default Libraries folder (for example, My Test Templates.hdl), and click Open.
- Select Employment Agreement and
click
Edit. The template appears, ready for you to edit.
Repeat a Paragraph
You can include lists of answers in your documents by repeating variables and allowing the user to enter as many answers as necessary. You repeat variables by surrounding the variables with a REPEAT instruction. Instead of collecting and merging a single answer, as variables normally do, the repeated variable can merge an entire list of answers into the assembled document.
In the Employee Personal Data template, employees must list each college they’ve attended, as well as degrees earned and the curriculum studied. Each college is listed in its own paragraph.
To insert the REPEAT instruction
- In the EDUCATION DATA section, highlight the indented paragraph under Colleges or Universities Attended. (Make sure you include the paragraph mark.)
This is how it should look in Word:
This is how it should look in WordPerfect:
- Click the
REPEAT Field button. The REPEAT Field dialog box appears.
You must create the dialog you will use in the REPEAT instruction. (The variables you will add to the dialog have already been created for you.)
To create the dialog
- In the Dialog box, type Educational Information and click the
Edit Component button. The Dialog Editor appears.
- Drag the following variables, in this order, from the Components list to the Contents list:
University or College Name
Years Attended
Curriculum Studied
Degree Earned
Next you must specify the style for the repeated dialog. You can either present the list as a series of dialogs or as a single spreadsheet with multiple entry points.
To choose a presentation style for the list
- At the Style drop-down list, make sure Repeated Series is selected.
- Click OK at the Dialog Editor. (Do not close the REPEAT Field dialog box yet.)
Sort the List of Answers
When creating a list of colleges, not all users will enter the schools in the order they attended them. You can organize the list by sorting its answers.
To sort the list based on dates attended
- At the REPEAT Field dialog box, click Show Advanced. The dialog box expands to show advanced options.
- Click the Sort by drop-down button. HotDocs displays a list of variables used in the dialog.
- Select Years Attended.
- Click the Ascending drop-down button and choose Descending. This will list colleges in order, starting with the most recent.
- Click OK to close the REPEAT Field dialog box. The REPEAT instruction is merged in the template.
- If you are using Word, position your cursor before the «REPEAT Educational Information» instruction and press the Backspace key so the REPEAT instruction is aligned with the left margin. (Doing this ensures the list is properly tabbed in the assembled document.) If you are using WordPerfect, do nothing.
Test a Portion of the Template
Just as you can test assemble the entire template, you can select just a portion of the template text and test it.
To test the REPEAT instruction
- At the template, select the text starting with the opening REPEAT instruction and ending after the closing REPEAT instruction, like this:
- Click the
Test Assemble button. The test assembly window appears.
- Answer the questions in the first dialog.
- Click the
Add Another. A new, empty repetition of the dialog, Educational Information, appears again.
Notice that as you provide answers at each dialog, HotDocs adds repeated dialog icons to the interview outline. If you later decide to add more information, you can click the last dialog and then click the
Add Another button again.
- Enter answers for as many colleges as you want, clicking
Add Another for each new college. When you are finished, click
Next.
- Click the Document Preview tab to see the generated list. Notice how the list is sorted in order, starting with the most recent school.
- Close the test assembly window. HotDocs returns you to the template.
Create a Sentence-Style List
You can also use REPEAT instructions to create lists within a sentence. When repeating a part of a sentence, you can specify the punctuation that will be used to separate the items in the list.
Next, you will insert a list of the degrees the employee has earned. You can use the dialog you created for the previous REPEAT instruction.
To create a sentence-style list
- Under the Degrees Earned heading, select the text after the colon, «Degree Earned» («University or College Name»). (Do not select the closing period.)
- Click the
REPEAT Field button. The REPEAT Field dialog box appears.
- Click the Dialog drop-down button and choose Educational Information.
- Click the Format drop-down button and choose a, b, and c from the list.
You will now create a filter to show only those schools where the employee has received a degree.
Create a Filter
In the previous paragraph in the template, you created a list of all colleges or universities the employee attended, regardless of whether he or she earned a degree from the school. In this paragraph, you will filter the list to show only those colleges where the employee received a degree.
A filter must result in a true/false (or yes/no) value. In this instance, the filter will list only the colleges where the employee earned a degree.
To create the REPEAT instruction
- At the REPEAT Field dialog box, click Show Advanced.
- Click the
Edit Component button next to the Filter by drop-down list. The Computation Editor appears.
- In the Variable Name box, enter the name Graduated.
- In the Script box of the Computation Editor, enter this script:
Degree Earned != "No Degree"
The operator != means “does not equal.”
This expression looks at the answer for the Multiple Choice variable, Degree Earned. For each repetition, if the user selects any answer but No Degree, the school (along with the degree achieved) is merged in the document.
- Click OK at the Computation Editor.
- Click OK at the REPEAT Field dialog box. The REPEAT instruction is merged in the template.
If you’d like, you can test your work to see how the list is repeated, as well as filtered. To do this, highlight the portion of the template you want to test, click the Test Assemble button, and answer the questions in the interview. Review the document at the Document Preview tab. Close the test assembly window when you are finished.
Conclusion
You are now finished with this lesson. In it, you learned how to repeat the text of an entire paragraph to create a list of answers. You also learned how to repeat a portion of text within a paragraph. Finally, you learned how to punctuate, sort, and filter answers in a list to customize how the list appears.
If you do not want to go on to Lesson 16 at this time, click the HotDocs Save and Close button to close the template. Then exit HotDocs.
If you are continuing on to Lesson 16, click the Save button to save your work.