Back to List
Placeholder | Replace With |
mult_choice_Var | A Multiple Choice variable |
num | A number value that indicates which selected option to return |
This expression lets you retrieve individual options (answers) selected in a Multiple Choice variable. It returns a text value that corresponds to the defined answer (as designated by the num placeholder).
In the following example, you want to generate a list of employees that have various different work projects they need to complete. Multiple employees may work on one individual project. Once you have this list, you want to generate a work list report for each employee on the list.
To accomplish this, you first repeat a dialog (EmployeeList) that asks which employees are supposed to work on a given assignment (using the Multiple Choice variable, EmployeeNames). As HotDocs repeats this list, the union expression adds each selected, original name from each repetition to a new Multiple Choice variable, UniqueList.
Once all of the unique answers have been added to UniqueList, HotDocs then uses the selection expression to retrieve each individual answer from UniqueList. The result of the script merges these names in a report.
erase UniqueList
repeat EmployeeList
set UniqueList to union( UniqueList, EmployeeNames )
endRepeat
erase ProjectParticipant
set Index to 1
while selection( UniqueList, Index ) != ""
set ProjectParticipant[Index] to selection( UniqueList, Index )
increment Index
endWhile
Back to List