The ifblank
tag is used to populate a numeric value for questions that are left blank. This tag works on open-ended text questions within a table where there are multiple questions. Values are auto-populated and stored in the database when a response is not entered. The value is set in the data once the question validates successfully.
This data cleaning tag is important for more advanced reporting functionality like averages, and situations where a blank is not the same as a 0 (zero). The ifblank
tag is most useful for a table that sums up to 100%; any spaces that are not filled are implicitly considered to be '0' (zero) for the calculation.
Note: ifblank
only acts on fields that are seen by the respondent. Use if not set
to populate values on all possible fields, regardless of whether or not they are seen.
Syntax
You can use the ifblank
tag in a question, in a set defaults
definition, in a class, or on a table.
ifblank: value
Examples
100% table
In the example below, the ifblank
tag is used in conjunction with the showcolumntotal
tags to assist in the creation of a table that requires the total to sum to 100%. The respondent is required to enter numbers in the rows until the total reaches 100, then any row that is left blank will be set to '0' in the data.
Reducing respondent fatigue
In this example, the brand list is relatively long, and it asks for a numeric input for each brand, which is more work for the respondent than clicking or tapping buttons. The ifblank
tag is added so that respondents only need to answer for the brands they have consumed, as it is safe to assume that a blank response is the same as '0'.
Note: The ifblank
tag allows a required question or table to be skipped, similar to adding required: n
to the question or table. The difference is the data values for a question or table skipped by ifblank
are set to a specified value. Questions or tables skipped by required: n
allow respondents to continue without a response, but the data locations are left blank.
A question or table with ifblank
will not return the specified value unless the page is 'seen' and submitted, the values will remain blank if the question or table is skipped.
Comments
0 comments
Please sign in to leave a comment.