The countChecked
function returns the number of items selected in a checkbox (multiselect) question. It can be included in conditional statements or used to return the number of options that were checked in a checkbox question.
1. Which hotel facilities did you use? Please check all that apply.
type: checkbox
1. Restaurant
2. Bar
3. Health club
4. Swimming pool
2. Where you aware that our hotel offers these extra facilities to make your stay more enjoyable?
showif: countChecked($Q1) <= 2
type: radio
1. Yes
2. No
3. Overall how did you feel about the [* countChecked($Q1) *] hotel facilities you used?
showif: countChecked($Q1) > 0
type: radio
1. Really liked
2. Liked
3. Neither liked nor disliked
4. Disliked
5. Really disliked
Note: The above example uses a Perl code block to allow the countChecked
function to render the number checked on screen. Without this it, would render the text on screen rather than evaluating the function. For more information, see Piping with Perl.
Tip! countChecked
also allows programmers to specify a range of options to be counted. countChecked($Q1,1..3)
will return only the number of options among the specified options 1, 2, 3 that are checked.
Comments
0 comments
Please sign in to leave a comment.