Conditioned text widgets are advanced versions of show text
and set text
. These widgets dynamically select the content to display from a list, based on the respondent's answers or survey logic. There are two types of conditioned text widgets:
-
show conditioned text
: Displays content once, where it's placed in the Survey Programming Language (SPL). -
set conditioned text
: Creates content that can be inserted, or piped, repeatedly throughout the survey.
Single-use content with 'show conditioned text'
show conditioned text: SOURCEINTRO
1. Reminder, only individuals who complete the full survey will receive a gift card. {if anyChecked($QSAMP,991)}
2. Thank you. You have qualified to complete the rest of the survey. {if anyChecked($QSAMP,1,5,44)}
Details
- Create a
show conditioned text
(aliasshow ct
) by providing a descriptive ID, followed by a list of options with the content to select from. Then, add a condition decorator to the end of each option to define the criteria for that option to be chosen. - The selection prioritizes the options in order from top to bottom. If multiple options qualify for selection, the first qualifying option in the list is used. If no options qualify, no content is displayed.
-
show conditioned text
widgets generate system variables with the unique ID assigned. These variables can be exported in the data and referenced in the survey logic. -
show conditioned text
does not insert a page break by default. Addautopage: y
if one is needed.
Tip! Conditions are not required for every option. If the last option has no condition, it acts as a "default" if no other options apply.
Multi-use content with 'set conditioned text'
4. How many children do you have?
type: integer
range: 1-20
set conditioned text: CHILD
1. child { if $Q4==1 }
2. children { if $Q4>1 }
5. What is your favorite restaurant to dine at with your __CHILD__?
type: text
maxlength: 35
Details
- Create a
set conditioned text
(aliasset ct
) by providing a descriptive ID, followed by a list of options with the content to select from. Then, add a condition decorator to the end of each option to define the criteria for that option to be chosen. - The selection prioritizes the options in order from top to bottom. If multiple options qualify for selection, the first qualifying option in the list is used. If no options qualify, no content is displayed.
-
set conditioned text
widgets generate system variables with the unique ID assigned. These variables can be exported in the data and referenced in the survey logic. - To display a
set conditioned text
, reference it in the SPL by including double underscores around the set text ID, (e.g.,__CHILD__
).
Tags
The following tags can be used with set conditioned text
or show conditioned text
widgets.
Tag | Description |
desc |
Modifies how the conditioned text is shown in reports, both its system variable and anywhere a |
bare |
Inserts HTML as-is, without a |
|
For |
Additional examples
Using the 'bare' tag
You can use the bare
tag to prevent content from being wrapped in <div> </div>
tags. This is helpful when there are formatting issues, such as added line breaks.
For example:
Syntax | Survey page HTML |
show conditioned text: MY_text 1. Survey content displayed here. { if $Q1==1 } 2. Alternate content |
<div class="MY_text-wrapper i-freetext i-cst">Survey content displayed here.</div> |
show conditioned text: MY_text bare: y 1. Survey content displayed here. { if $Q1==1 } 2. Alternate content |
Survey content displayed here. |
Using 'optsfrom' with conditioned text
Because the show conditioned text
and set conditioned text
widgets use lists, they also support the use of the optsfrom
tag and question label shorthand. In the example below, the conditioned text TOOL uses the options from Q6 for its list. The input 'Q6' is shorthand for all options selected at Q6.
Tip! To create a lowercase version of the same conditioned text (e.g., "hammer"), see the next example.
Customizing content with option data
Option data decorators let you customize the content displayed by show conditioned text
or set conditioned text
. In this example, the LC option data contains lowercase texts for the list options. By applying the text
decorator to the optsfrom
listcall, you can use these alternate texts in the set conditioned text
.
Combining 'set text' and 'set conditioned text'
Text widgets are highly flexible. You can even use multiple set texts within a conditioned text. In the example below, set text
widgets define detailed concept descriptions, which are then piped into the set conditioned text
options. Finally, the selected set conditioned text
is used in the show text
.
Comments
0 comments
Please sign in to leave a comment.