logo SmartSurvey / Scripting Docs
Back to Docs
Question Type
7 Single Grid Grid *GRIDSR

Presents a matrix where each row is a statement or attribute and the respondent selects exactly one column option per row. Column options are defined once using *GRIDLIST and then referenced in any grid question with *USEGRIDLIST. Use valueof[Qx.n] to access a specific row's response.

Type ID 7
Directive *GRIDSR
Category Grid
Script Definition
script definition (.q)
-- Step 1: Define the column scale once using *GRIDLIST.
-- Give it a name so it can be reused by multiple grid questions.
*GRIDLIST "SatScale"
1:Very Dissatisfied
2:Dissatisfied
3:Neutral
4:Satisfied
5:Very Satisfied

-- Step 2: Define the grid question and attach the list with *USEGRIDLIST.
*QUESTION Q7 *GRIDSR *USEGRIDLIST "SatScale"
Q7. Please rate each aspect of the product.
1:Product Quality
2:Price/Value
3:Customer Service
4:Packaging
Use in Expressions
expressions
valueof[Q7.1]>=4   -- row 1 (Product Quality) rated Satisfied or above
valueof[Q7.3]=1    -- row 3 (Customer Service) rated Very Dissatisfied
valueof[Q7.2]>=4 & valueof[Q7.4]>=4   -- rows 2 and 4 both rated 4 or above
valueof[Q7.n] where n is the 1-based row number. The value returned equals the column code selected in that row.
Why *GRIDLIST? It defines a named set of column options (the scale) separately from the question body. You write the scale once at the top of the script and give it a name. This keeps the question definition short and prevents repeating the same 5-point scale across every grid question in the survey.
Why *USEGRIDLIST? It attaches the named column list to a specific *GRIDSR question at runtime. If two grids share the same scale (e.g. SatScale), both use *USEGRIDLIST "SatScale" — change the scale definition once and both questions update automatically.
*GRIDLIST must be defined in the script before any *QUESTION that references it with *USEGRIDLIST. Define all your grid lists near the top of the script file.
Related