Professional > Interview scripting > Writing interview scripts > Repeated questions > Initial and default cell values
 
Initial and default cell values
Grids are displayed with blank cells and respondents must usually enter or select a response in every cell of the grid before they can continue to the next page. In large grids where only some cells may be relevant, you can make the grid less of a chore to complete by setting a default response such as 0 or “Not applicable” for all cells. Any cells that the respondent leaves blank will be assigned the default value. This is particularly useful for repeated numeric and text questions where respondents often do not need to enter values in all cells.
Respondents do not see these default values the first time the grid is displayed, but if the grid is redisplayed for any reason (errors or snapbacks, for example) default values will be shown in all cells that the respondent previously left blank.
Another option is to define an initial value for each cell so that the grid is displayed with this value in each cell. Any cells that the respondent does not change are saved with the initial value as the data for those cells.
You can set default and initial values in either the metadata or the routing section of the interview script. If the same value applies to all cells in the grid, it is probably easiest to set the value in the metadata section, as you would for non-repeated questions, so that it is immediately obvious to anyone looking at the question’s definition. For example:
WhichYear "WhichYear" loop [2005, 2006, 2007]
fields (
HealthInsuranceCost "Approximately how much did you pay for
       health insurance in {@WhichYear}?" long [1 .. 9999]
       initialanswer(0);
) expand;
To set a different default or initial value for each repetition
Put the following statements in the routing section:
LoopName[Repetition].Qname.Response.Type = Value
Parameters
LoopName
The name of the loop.
Repetition
The repetition number for which the default or initial value is to be set.
Qname
The name of a question in the loop.
Type
Default for a default value or Initial for an initial value.
Value
The response for this question. The value must be a valid response to the question and must match the question’s data type; that is an integer for a long question, a real number for a double question, or a text enclosed in double quotes for a text question.
Example
HowManyLoop[..].Brand.Response.Initial = 0
PriceLoop[1].Cost.Response.Initial = 0.0
NameLoop[5].Name.Response.Default = "No answer"
See also
Repeated questions