A class is a labeled set of tags which can be referenced by other widgets. Widgets referencing a class inherit all of the tags and values defined in the class. Classes promote a consistent, streamlined, standardized appearance to surveys, and make it easy to modify many widgets at one time. If need be, class properties can be overridden locally at the question level.
Syntax
Define a class of tags by assigning it a name with the setclass
tag. All tags following the setclass
tag and before the next blank line are included in the class. The class can then be applied to other widgets by referencing it in a class
tag.
# Define setclass: a_custom_class tag 1 here tag 2 here etc. # Reference, inside of another widget class: a_custom_class
Widgets inherit whatever tags and values are present in the class, except if an identical local tag is also present. In that case, the local tag's input takes precedence.
Example
Basic numeric class
The class HHI is used to define numerical questions related to income. As such, the datatype
is set to 'whole' so only positive integer values are accepted, up to 8 digits in length (maxlen: 8
). The prefix '$' is also included as these questions are all related to income.
Overriding a class locally
The following example uses the class CTABLE to create a carousel table (a.k.a., Horizontal Carousel Battery). The carousel settings and table type are defined in the class, and then applied to T4 and T5. T5 also uses the carousel
tag to override the class-defined carousel features with the slides
and progress
decorators. Note that T5 does not override the navigate
decorator, so that setting still applies in T5.
System classes
System classes are classes that have been programmed into the IntelliSurvey platform to be used across all IntelliSurvey servers. They were created for use with IntelliBuilder and do not require definition within a survey's source code. Currently we have the following system classes:
- add_to_100_percent
- nps
- nps_embeddedanchor
- nps_table
add_to_100_percent
The add_to_100_percent system class was created so that SPs and Survey Creators (SCs) could more easily define "add-to-100%" tables. The class uses the required
tag set to "no" to allow respondents to skip a row as long as their total equals 100. For every row skipped (both left unseen and unanswered) the if not set
tag will automatically store a '0' in the data, which is a common request from clients.
The class is defined as follows.
set class: add_to_100_percent type: number table datatype: whole if not set: 0 showcolumntotal: Total (must be 100%) {total: 100} {message: Total must be 100%.} range: 0-100 postfix: %
required: n
If you want to force the respondent to answer every visible row, you can simply override the class locally by applying required: y
to the table widget. Remember, if not set
will still autocode a value of '0' in the data map for all unseen rows. This can also be modified as needed by making a local copy of the class.
The system class can then be applied as shown below to create an "add-to-100%" table with more compact code.
Like regular classes, system class properties can be overridden locally on individual questions. For more on creating "add-to-100%" tables in IntelliBuilder, see Additional elements and features.
nps
The nps system class is used to created an NPS rating scale question that presents the scale horizontally with headers, and also includes the reportoptions
and metric
tags to present the data in a more meaningful way for clients in the reporting applets. In particular, the metric
tags are used to categorize respondents as "Detractors," "Neutrals," and "Promoters" and assign them scores based on which group they fall into.
The class is defined as follows.
setclass: nps hscale: y type: radio headings: Not at all likely, Extremely likely series: 0..10 reportoptions: <<END presets => 1, presets_menu => { 1 => { name => 'NPS', report_options => { analyze => { responsebuckets => 'nps' }, } } } END metric: nets {args: 0,1,2,3,4,5,6} {desc: Detractors (0-6)} metric: nets {args: 7,8} {desc: Neutrals (7,8)} metric: nets {args: 9,10} {desc: Promoters (9,10)} metric: transformed_average {args: 0-6== -100; 7,8==0; 9,10==100} {desc: NPS}
Since options are already included in the nps class via the series
tag, an application of this could be coded as simply as the following.
nps_embeddedanchors
Unlike the nps class, nps_embeddedanchor uses "embedded" headings at the ends of the rating scale instead of using the headings
tag. As such, the options are defined individually instead of with the series
tag, and option '0' and option '10' include the headings in the option text. The inputs for the reportoptions
and metric
tags are the same as the nps class, creating a nearly identical reporting output.
setclass: nps_embeddedanchors hscale: y type: radio 0. 0 - Not at all likely 1. 1 2. 2 3. 3 4. 4 5. 5 6. 6 7. 7 8. 8 9. 9 10. 10 - Extremely likely reportoptions: <<END presets => 1, presets_menu => { 1 => { name => 'NPS', report_options => { analyze => { responsebuckets => 'nps' }, } } } END metric: nets {args: 0,1,2,3,4,5,6} {desc: Detractors (0-6)} metric: nets {args: 7,8} {desc: Neutrals (7,8)} metric: nets {args: 9,10} {desc: Promoters (9,10)} metric: transformed_average {args: 0-6== -100; 7,8==0; 9,10==100} {desc: NPS}
Applying the nps_embeddedanchor class can be done as simply as with the nps class.
nps_table
The nps_table system class is defined nearly identical to the nps class, just for tables.
setclass: nps_table type: radio_table headings: Not at all likely, Extremely likely series: 0..10 reportoptions: <<END presets => 1, presets_menu => { 1 => { name => 'NPS', report_options => { analyze => { responsebuckets => 'nps' }, } } } END metric: nets {args: 0,1,2,3,4,5,6} {desc: Detractors (0-6)} metric: nets {args: 7,8} {desc: Neutrals (7,8)} metric: nets {args: 9,10} {desc: Promoters (9,10)} metric: transformed_average {args: 0-6== -100; 7,8==0; 9,10==100} {desc: NPS}
An application of the nps_table class could be programmed like below.
Comments
0 comments
Please sign in to leave a comment.