UNION Function

The UNION function creates a single list of the unique options the template user selects from two Multiple Choice variables.

The UNION function takes the answers from two multiple choice variables, creates a list of all the answers in both, and populates a third multiple choice variable with that list. The list that UNION generates will not include a duplicate entry if something is selected in both multiple choice variables. Replace M1:MULT_CHOIC_VAR and M2:MULT_CHOIC_VAR with the two multiple choice variables for which you want a list of answers.

Function name UNION
Usage model UNION (m1:MULT_CHOICE_VAR, m2:MULT_CHOICE_VAR)    
Parameters The UNION functions requires you to replace two parameters:

m1: MULT_CHOICE_VAR

The function uses the answers from both multiple choice variables to create a third list.

m2: MULT_CHOICE_VAR

The function uses the answers from both multiple choice variables to create a third list.
Result A multiple choice variable.

Example

Consider a situation where you have two "select all that apply" multiple choice variables that represent states in which property is owned, PropertyType1MC and PropertyType2MC, and you want to combine the two to form a list of states that property of types 1 and 2 are owned and store this list in a multiple choice variable called PropertyTypes1and2MC.  Your code might look something like this:

SET PropertyTypes1and2MC TO UNION(PropertyType1MC, PropertyType2MC)

The result of this would be a list of states selected in either PropertyType1MC or PropertyType2MC while not including any state twice in the new list if it is selected in both.

Download

After you download the example template, you can import the template to any workspace to see this example code in action.