Questionnaire Rules
Questionnaire rules allow dynamic behavior based on user input. They control visibility, scoring, grading, and more using conditions and actions that respond to responses.
1. Rule Components
Each rule consists of:
- ID: A unique identifier.
- Test: A condition using variables or responses.
- Action: What occurs if the test passes (e.g., show question, assign score).
- Comment (optional): Clarifies purpose.
- Constraint (optional): Defines when the rule executes.
2. Writing Rules
Define the ID
Use descriptive, unique identifiers to help track rule behavior.
Create Test Conditions
Rules are triggered by conditional logic using:
==
,!=
,<
,>
,<=
,>=
,in
- Logical operators:
and
,or
Example:
{ "id": "gradeset.02", "test": "@__SCORE > 11 and @__SCORE < 30", "action": "GRADESET('Moderate Risk')", "comment": "Set grade moderate risk" }
Specify Actions
Actions include:
ASKQUE
,HIDEQUE
,CLEARANS
SCOREADD
,SCORESET
,SCORESETTOTALRESPONSE
GRADESET
,SETDISPLAYOPTIONS
,SETANS
Example:
{ "id": "HIDEASKCLOUD.01", "test": "@HOSTING.response=='Cloud'", "action": "ASKQUE('WHICH_CLOUD')", "comment": "Show question" }
3. Test Types
Test Type | Description |
---|---|
Comparison | "1==1" , "2>1" |
Attribute reference | @QUESTION.response=='Yes' |
Checkbox | 'CISO' in @ROLES.response |
Compound | @__SCORE > 11 and @__SCORE < 30 |
4. Available Actions
Action | Description |
---|---|
ASKQUE , HIDEQUE , CLEARANS | Show/hide/reset questions |
SCOREADD , SCORESET , SCORESETTOTALRESPONSE | Score manipulation |
GRADESET | Assign a grade string |
SETANS | Set a specific answer |
SETDISPLAYOPTIONS | Show score/grade/debug info |
5. Scoring and Grading
Per-Question Scoring
- Enable scoring in the Basic Info tab.
- Assign scores per choice or per text input.
- Auto-totaling is supported.
Rule-Based Scoring
- Use
SCORESET
,SCOREADD
, andSCORESETTOTALRESPONSE
. - Grades can be set via rules based on score ranges.
Example:
{ "id": "gradeset", "test": "@__SCORE < 11", "action": "GRADESET('Low Risk')" }
Display Score and Grade (Debug)
{ "id": "displayscores", "test": "1==1", "action": "SETDISPLAYOPTIONS('displayscore=true', 'displaygrade=true')" }
6. Rule Validation
RegScale validates rules on form save (as of v5.36). Common errors:
= instead of ==
- Invalid JSON syntax
- Invalid action names
7. Custom Assignment Emails
Add text to the Instructions field in the Basic Info tab to override the default email body.
8. Best Practices
- Apply rules clearly and consistently.
- Avoid overlapping/conflicting logic.
- Use readable IDs and structured logic.
- Test thoroughly before publishing.
Updated 29 days ago
Did this page help you?