Choice expressions

Examples of report expressions for choice questions are provided below.

If a select one question is referred to in a placeholder by itself, for example, ${select_one}, it will return the choice label. If a select one question is used in an expression, or if the question uses an external select, a select one question will return the name of a choice item. The following example uses a choice name, rather than a label, for a conditional statement:

${if select_one=="choice1Name"}The user selected the first choice.${/}

To display the name of a choice rather than the label, use the getValue expression:

${select_one | getValue:""}

For both select one and select multiple questions, you can use an expression to place a check box next to a choice item, which is filled depending on the response to the question. The choice name—not the choice label—must be used. The following expressions display selected fruits:

${select_one | checked:"apple"} Apple

${select_one | checked:"pear"} Pear

When Allow "Other" has been enabled for a select one or select multiple question, use the choice name of other:

${select_one | checked:"other"} Other fruits you like: ${favFruits_other}

Select multiple questions support expressions to output the total amount of choices selected and to output a specific selected choice:

${select_multiple | countSelected}

${choiceQuestion1 | selectedAt:2}

Note:

The selectedAt expression begins counting selected choices at zero. This means that ${choiceQuestion1 | selectedAt:2} will return the third selected choice.

Select multiple questions also have a supported expression to return all selected choice items as a bulleted list, as follows:

${select_multiple | appearance:"bullets"}

Note:

If the label of your choice item contains double quotation marks, they must be preceded by a backward slash; otherwise, the report will not print. A backward slash is not necessary for single quotation marks. The following is an example:

${select_one | checked:"Service provided by \"Greg's Plumbing\""} Service provided by "Greg's Plumbing"