logo SmartSurvey / Scripting Docs
Back to Docs
Built-in Function
numberofresponse[Qx] Count

Returns the number of options selected in a multiple-response or grid question. For *MR this is the count of checked options. For grid questions it counts filled rows.

Parameters
Parameter Type Description
Qx Question ref A *MR, *GRIDSR, or *GRIDMR question
Returns: Integer — number of selected options or filled rows
Examples
expressions
numberofresponse[Q2]>=2    -- at least 2 brands selected
numberofresponse[Q2]=1     -- exactly one option selected
numberofresponse[Q2]=0     -- nothing selected
numberofresponse[Q8]>=3    -- at least 3 cells selected in grid Q8
For *SR questions, numberofresponse always returns 1 if answered. Use primarily with *MR and grid types.
Do not use Q2=0 to test "no selection". Always use numberofresponse[Q2]=0.
Related