HotDocs Tips & Tricks

Tips, tricks and solutions with the HotDocs document assembly platform
Thursday, December 28, 2006

Instruction Model: ADD TEXT TO MULT_CHOICE


This tip covers when to use and how to use the HotDocs Instruction Model: ADD TEXT TO MULT_CHOICE.  HotDocs supports dynamic multiple choice variables.  A list of options (and their associated prompts) for a multiple choice variable can be seen in the definition of a particular component. However, this restricts the user to options known at the time that a component file is authored. This instruction model lets the developer dynamically change the option values and their associated prompts based on answers given by the user during an assembly.

Article Content

What are the elements?

- ADD: The instruction to Add Text
- TEXT: A Text Value, a Text Variable, or a Text String consisting of Text and Variables
- MULT_CHOICE: A Multiple Choice Variable (Single select and Multi-Select)

Other Related Instructions?

- CLEAR MULT_CHOICE:  Will clear ALL options and prompts for a Multiple Choice Variable

How do you use it?

1. Build from a Repeat
The sample below is used to set the options for a Beneficiary selector.  This option could itself appear on a REPEAT.  The beneficary variable is first CLEARed. Then the script loops through the list of children, adding each child’s name, one at a time to the option list.

CLEAR BENEFICIARY Name MC
REPEAT CHILDREN RPT
      ADD CHLD Name TE TO BENEFICIARY Name MC
END REPEAT

2. Build from a Script
The sample below is used to set the options for a Beneficiary selector.  This option could itself appear on a REPEAT.  The beneficary variable is first CLEARed. Then the script loops through the list of children, adding each child’s name, one at a time to the option list.

CLEAR CLI Married MC
ADD 
"Married|Client is married" TO CLI Married MC
ADD 
"Single|Client is single" TO CLI Married MC
ADD 
"Divorced|Client is divorced" TO CLI Married MC
ADD 
"Widowed|Client is widowed" TO CLI Married MC

3. Build from a Repeat and Add Custom Prompt
The sample below is used to set the options for a list of children to disinherit from a will.  The variable is first CLEARed. Then the script loops through the list of children.  For the option value, it adds each child’s name.  However, for the prompt, it puts in the child’s relationship to the , one at a time to the option list.

CLEAR HEIR Disinherit Name MS
REPEAT CHILDREN RPT
      
// Change prompt based on gender of child
      
IF CHLD Gender MC "Male"
           
ADD "«CHLD Name TE»|Client's son «CHLD Name TE»" TO HEIR Disinherit Name MS
      
ELSE
           
ADD "«CHLD Name TE»|Client's daughter «CHLD Name TE»" TO HEIR Disinherit Name MS
      END 
IF
END REPEAT

Extended Thoughts:

SPECIAL NOTES:

- You must create the Variable and assign a default option (e.g. “Name Goes Here” or “1")
- You must use a computation script for the CLEAR and ADD instructions.
- The script must be processed before you display the Multiple Choice Variable.
- However, given the way the HotDocs interview works, you can accomplish this by putting the computation on the Dialog Script where the Mutiple Choice Variable is used, or in an INTERVIEW script.  If you choose the latter option, it can go anywhere in the script.

Posted by Seth
Page 1 of 1 pages

Statistics

Page Views: 5891
Page rendered in 0.6307 seconds
34 queries executed
Total Entries: 82
Most Recent Entry: 07/16/2008 11:19 am
Total Members: 5
Total Logged in members: 0
Total guests: 4
Most Recent Visitor on: 08/28/2008 01:34 pm
Most visitors ever: 87 on 11/07/2006 02:22 pm