The CLEAR instruction removes all current options from the Multiple Choice variable you specify.
The CLEAR Instruction is only available when you are creating a computation.
The ADD instruction enables you to add options to a multiple choice variable, but before you can add new options, you first have to clear the existing options using a CLEAR instruction. Once the options are empty, you can use the ADD instruction to add the new option list.
Instruction name | Model | After you drag and drop the model into the script tab: |
CLEAR | CLEAR ⟦MULT_CHOICE_VAR⟧ | Replace ⟦MULT_CHOICE_VAR⟧ with the multiple choice variable whose options you want to remove in preparation for adding new ones. |
A template author is creating a template for writing up meeting minutes. At the start of the interview, they want the template user to type in a list of the committee members present, and in the next dialog, they want the template user to select the meeting chairperson from that list of members.
The template author creates two dialogs:
They then create a computation, and in the script tab, they type the following:
CLEAR CommitteeChairperson
REPEAT MemberDetails
ADD MemberName TO CommitteeChairperson
END REPEAT
The computation first uses the CLEAR instruction to remove any existing options from the CommitteeChairperson multiple choice variable. The REPEAT instruction enables the template user to add as many committee members names to the list as needed and the ADD instruction turns that list of answers into a list of options for the CommitteeChariperson multiple choice variable. The END REPEAT instruction closes the repeated region. When the template user moves on to the Chairperson dialog, they can now select a committee member from the list they created.
After you download the example template, you can import the template to any workspace to see this example code in action.