The show if
tag is used to dynamically display questions, tables, or text when a specified condition is true.
1. Which of the following cities have you visited before?
type: checkbox
1. New York
2. Boston
3. Chicago
4. Denver
5. Los Angeles
2. When was the last time you visited Boston?
type: radio
show if: anyChecked($Q1,2)
1. Within the last month
2. 1-2 mos. ago
3. 3-5 mos. ago
4. 6-12 mos. ago
5. Over a year ago
Tip! The skip if
tag is the opposite of show if
and may be preferable to match logic specified in a client-copy of a survey.
Details
-
show if
applies to most widgets and question types but should not be used for blocks, groups, or anew page
widget. Use thecondition
tag instead. -
show if
accepts a conditional statement, 'always', and 'never' as input. - The
show if
condition can reference content on the same page or elsewhere within the survey. - Use
show if: always
to always display a widget, andshow if: never
to always hide it. Note, applyingshow if: always
does not override other conditions that may apply to the widget. - To apply
show if
to a table row or column, thestart table
widget is required.
Additional examples
Dynamically displaying a 'show text'
The show if
tag can be used with the show text
widget to dynamically display other content such as text, HTML, images, etc. In the following example, the show text
"SW_FAN" will be displayed only if the respondent chooses 'Definitely!' or 'Sort of' in Q3.
3. Are you a Star Wars fan?
type: radio
1. Definitely!
2. Sort of
3. Not really
4. What's Star Wars?
show text: SW_FAN
text: <p>May the Force be with you. Always.</p>
show if: anyChecked($Q3,1,2)
Dynamically displaying table rows or columns
To show or hide a table row or column, place a show if
tag on it. In the example below, the second row in T5 will only be shown if the respondent answered '5' or more in Q4.
4. How long have you been in business?
type: integer
range: 0-60
postfix: years
start table: 5
size: 10
type: text
1. Who is currently your primary distributor?
2. Who was your primary distributor <b>5 years ago</b>?
show if: $Q4 >= 5
end table
The show if
tag can dynamically show or hide rows and columns in multi-part tables. In T8, column 1 appears if Q6 is "5" or greater, and column 3 appears if Q7 is "Yes."
6. How long have you been in business?
type: integer
range: 0-60
postfix: years
7. Do you anticipate being in business 5 years from now?
type: radio
1. Yes
2. No
start table: 8
intro: What percent of your usage was insource and outsourced?
type: integer
range: 0-100
show column total: Total {total: 100}
if not set: 0
postfix: %
rows:
1. Insourced
2. Outsourced
--
colid: 1
headings: 5 years ago
show if: $Q6 >= 5
--
colid: 2
headings: Today
--
colid: 3
headings: 5 years from now
show if: $Q7 == 1
end table
Comments
0 comments
Please sign in to leave a comment.