@PICK_MANY_QUESTION

Specifies that a variable will be multiple values out of a list of choices.

Before generating a document, DocuMold will display checkboxes to choose the values.

The variable will be a List containing the chosen values.

Usage

<# @PICK_MANY_QUESTION(variable, **see parameters below**) #>

Parameters

variable

(Required) The variable this applies to. Do not use double quotes (") around it, just write it as a usage of the variable.

choices:

(Named, Required) The choices to display. Can be a list of values, a list of list of two values (list of pairs), or a DT_CHOICES. See “More information” below

example_value:

(Named) The initial value in the form when preparing a template (via “Prepare a template”). If not given, the value of initial_value is used.

help_text:

(Named) Displays a clickable (?) bubble beside the label. Clicking it will reveal this text. Useful to give directions to the user of the DocuMold template.

initial_value:

(Named) The initial value in the form when using a template (via “Use a template”). This is also the default value of the example_value parameter.

label:

(Named) The text to display beside the checkboxes that asks for the value. Defaults to variable’s name.

optional:

(Named) Set this to TRUE to allow the user to pick no choices (value would then be an empty list)

Parameters with “Named” mean that you must specify the name of the parameter and a colon before its value. Ex: choices: "its value"

Examples

Example Result

<# @PICK_MANY_QUESTION(countries, label: “Countries of interest”, choices: [“Belgium”, “Canada”, “Other”]) #>

<# @PICK_MANY_QUESTION(currencies, label: “Currencies”,
choices: [[“Canadian Dollar”, “CAD”], [“Euro”, “EUR”], [“US Dollar”, “USD”]],
help_text: “Currencies conversions you want included”) #>

<# @PICK_MANY_QUESTION(employee, label: “Employee”,
choices: DT_CHOICES(“employees”, CONCAT(.first_name, “ “, .last_name))) #>

<# @PICK_MANY_QUESTION(discounts, label: “Discounts to apply”,
choices: [[“Member”, 0.1], [“Senior”, 0.15]]) #>

More information

This action does nothing to the document itself; it gets erased when generating a document.

When generating the document, the specified variable will be a list of the selected values. You can use the CONTAIN function to test if a value was selected.

The choices can be:

  • A list of values: each value will be displayed as a choice and the value will be in the variable when selected.
  • A list of list of 2 values: Basically a list of pairs. For each pair, the first value is the text to display besides the checkbox and the second value is the one that will be in the variable when this is selected. So [["By name", "name"], ["By age", "age"]] means the choices are By name and By age, and the variable will be set to either "name" or "age". This is useful to provide a clearer choice to the user, without having to write the longer text everywhere. Values can be non-text, such as numbers, dates, etc.
  • DT_CHOICES is a function that allows getting choices from a data table. See DT_CHOICES for more details.

All @..._QUESTION actions are normally placed at the end of the template to avoid overwhelming unfamiliar users.

The @IF action has no effect on the @...QUESTION actions. The @...QUESTION actions have an effect even when they is hidden.

See also