logo SmartSurvey / Scripting Docs
Back to Docs
Built-in Function
modof[Qx,n] Arithmetic

Returns the modulus (remainder) of dividing the response of Qx by n. Useful for sampling patterns (every nth respondent) or rotation logic.

Parameters
Parameter Type Description
Qx Question ref A numeric or single-response question
n Integer The divisor
Returns: Integer — remainder of Qx divided by n
Examples
expressions
modof[Q4,2]=0      -- age is an even number
modof[Q4,5]=0      -- age divisible by 5
modof[SYSID,3]=1   -- route every 3rd respondent
Combine with system variables like respondent ID for quota-based sampling rotation.
Related