Survey Programmers (SPs) are sometimes asked to ensure that specific table row or column conditions are met, such as a certain number of options selected per table row, or that contradictory or illogical option combinations are avoided. IntelliSurvey features built-in functionality to address these demands: row validate and column validate. These functions work similarly to a standard validation, except that both are attached to the table they are checking and permit reference of row or column decorators.
Syntax
Row validate
rowvalidatecondition: Validation condition, iterating through list of rows, permitting use of any available decorators. rowvalidatemessage: Message to display in event validation in not passed. Also permits use of decorators.
Tip! Starting in r8.2, SPs can instead use the rowval
and rowmsg
aliases for these tags. The tags and their aliases can be written with spaces, no spaces, or underscores – e.g., rowval
, row val
, or row_val
.
Column validate
colvalidatecondition: Validation condition, iterating through list of columns, permitting use of any available decorators. colvalidatemessage: Message to display in event validation in not passed. Also permits use of decorators.
Tip! Starting in r8.2, SPs can instead use the colval
and colmsg
aliases for these tags. The tags and their aliases can be written with spaces, no spaces, or underscores – e.g., colval
, col val
, or col_val
.
Single-line validation
Row and column validations can be written in a single line of code using the row validation
or column validation
tags. Either tag accepts a condition as its input, followed by the message
decorator and message text in curly braces.
row validation: [condition] {message: message text if condition not met} column validation: [condition] {message: message text if condition not met}
Examples
No more than two options checked per row
The following example allows respondents to select up to two (2) options per row. If the respondent selects more than two, the row validation condition will be violated, the validation message will be shown, prompting the respondent to "not select more than 2 attributes" for a given row element. Note the row validation message contains [text]
to pipe the specific row option text into the displayed message(s).
Note, applying the maxchecked
tag directly to the table could also serve the purpose of limiting the respondent to two options per row. However, the row validate message
tag has the advantage of proving a helpful, custom error message to the respondents.
T10 could instead use a single-line validation, replacing both the row validate condition
and row validate message
tags with the row validation
tag. Specify the condition first, followed by the message
decorator and text within curly braces - { } - as follows.
No more than two options checked per column
The mechanics for a column validation work in a similar fashion, but in the context of vscale ("vertical") tables. In such cases, the table generates data points by column, rather than by row. The column validation allows SPs to check a condition against each one of the column's selections.
Similar to T10, if you do not need to provide a custom message to the respondent, applying the maxchecked
tag directly to the table could also serve the purpose of limiting the respondent to two options per column.
The above vscale example can also use a single-line validation instead, replacing both the column validate condition
and column validate message
tags with the column validation
tag. Specify the condition first, followed by the message
decorator and text within curly braces - { } - as follows.
Multicolumn table
Note: If your table has multiple columns, the row validate message
must be affixed to the table root. That is, the row validate message
tag should be added before a column separator '--' has been defined.
In this example, respondents must give an assessment of a brand in column B if they are familiar with it in column A. The enableWhen
tag is included on column B so that it is only available when respondents indicate familiarity with one of the brands (selecting options 2-5) in column A.
Applying multiple row validations
Multiple row validations may be applied to a table by defining them in a heredoc within the row validations
tag. Line spaces are required between each set of conditions and messages within the heredoc since the tags are repeated.
Single-line validations can be substituted in the above example by applying multiple row validation
tags without the usage of heredoc as follows.
Validating values
Survey programmers should not let respondents enter invalid data where ever possible. The row validation
tag can also be used to check for inconsistencies while the respondent is taking the survey. For example, in T27 below we use the answer provided in T25 to limit the number they can enter at T27.
Comments
0 comments
Please sign in to leave a comment.