SurveyQuestion

Represents a single question within a survey with support for multiple input types (text, choice, rating, scale, boolean). Includes validation rules, display ordering, and conditional logic for dynamic survey flows.

12 properties
Schema

Properties

PropertyTypeModeDescriptionRequired
surveySurvey
stored

Reference to the survey this question belongs to

Required
textstring
stored

The question text displayed to respondents

Example: "How satisfied are you with our service?"

Required
typestring
stored

Type of question determining the input method

Values: text, textarea, single-choice, multiple-choice, rating, scale, date, number, boolean, file

Example: "rating"

Required
optionsjson
stored

Available options for choice-based questions (single-choice, multiple-choice)

Example: ["Very Satisfied","Satisfied","Neutral","Dissatisfied","Very Dissatisfied"]

Optional
requiredboolean
stored

Whether this question must be answered

Example: true

Optional
ordernumber
stored

Display order of the question within the survey

Example: 1

Optional
helpTextstring
stored

Additional help or instructions for the respondent

Optional
validationjson
stored

Validation rules for the answer (min/max values, patterns, etc.)

Optional
conditionjson
stored

Conditional display rules determining when this question is shown based on previous answers

Example: {"questionOrder":5,"operator":"equals","value":false,"action":"hide"}

Optional
metadatajson
stored

Additional question configuration

Optional
answersSurveyAnswer[]
calculated

List of answers submitted for this question

Optional
answerCountnumber
calculated

Number of answers received for this question

Optional

Examples

Example 1

{
  "@type": "SurveyQuestion",
  "survey": {
    "@type": "Survey",
    "title": "Customer Satisfaction Survey"
  },
  "text": "How satisfied are you with our service?",
  "type": "rating",
  "required": true,
  "order": 1,
  "helpText": "Rate from 1 (very dissatisfied) to 5 (very satisfied)",
  "validation": {
    "min": 1,
    "max": 5
  }
}

Example 2

{
  "@type": "SurveyQuestion",
  "survey": {
    "@type": "Survey",
    "title": "Customer Satisfaction Survey"
  },
  "text": "What aspects of our service did you like?",
  "type": "multiple-choice",
  "options": [
    "Speed",
    "Quality",
    "Price",
    "Customer Support",
    "Ease of Use"
  ],
  "required": false,
  "order": 2
}

Example 3

{
  "@type": "SurveyQuestion",
  "survey": {
    "@type": "Survey",
    "title": "Employee Engagement Survey"
  },
  "text": "How likely are you to recommend our company as a place to work?",
  "type": "scale",
  "required": true,
  "order": 1,
  "helpText": "0 = Not at all likely, 10 = Extremely likely",
  "validation": {
    "min": 0,
    "max": 10
  }
}

Example 4

{
  "@type": "SurveyQuestion",
  "survey": {
    "@type": "Survey",
    "title": "Vehicle Inspection Checklist"
  },
  "text": "Are the brake lights functioning?",
  "type": "boolean",
  "required": true,
  "order": 5
}

Example 5

{
  "@type": "SurveyQuestion",
  "survey": {
    "@type": "Survey",
    "title": "Vehicle Inspection Checklist"
  },
  "text": "Describe the brake light issue",
  "type": "textarea",
  "required": true,
  "order": 6,
  "helpText": "Please describe the malfunction in detail",
  "condition": {
    "questionOrder": 5,
    "operator": "equals",
    "value": false,
    "action": "show"
  }
}

Example 6

{
  "@type": "SurveyQuestion",
  "survey": {
    "@type": "Survey",
    "title": "Customer Satisfaction Survey"
  },
  "text": "What could we improve?",
  "type": "textarea",
  "required": false,
  "order": 3,
  "condition": {
    "questionOrder": 1,
    "operator": "lessThan",
    "value": 4,
    "action": "show"
  }
}