HotDocs Models: union( mult_choice, mult_choice )

Placeholder Replace With
mult_choice A Multiple Choice variable
mult_choice A Multiple Choice variable

This expression creates a single list of all unique options (answers) that have been selected across two Multiple Choice variables.

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