The Survey component

Asks multiple questions, all with the same options. Radio buttons are used to answer the questions.

In addition to the properties and methods listed below, this component inherits properties and methods from the superclass Component. For example, any Survey component has a label and defaultValue property even though these are not explicitly listed here.

Properties

NameDescriptionDatatypeDefault
labelPositionPosition of the label with respect to the survey. Can be 'top', 'bottom', 'right-right', 'left-right', 'left-left' or 'right-left'.String"top"
questionsThe questions to ask given as an array with fields:
  • label: Question to ask.
  • value: Value of the question to store after it has been answered.
Easy to set with the setQuestions method.
Dict/Struct
tableViewWhen true and the component is part of an EditGrid, the component's value is shown (simplified) in the collapsed row of the EditGrid.BooleanFalse
valuesThe options for every question. Must be an array with fields:
  • label: Text to display for the option.
  • value: Value to assign to the option.
Easy to set with the setValues method.
Dict/Struct

Methods

NameSyntaxDescription
setQuestionsobj​.setQuestions(​questions, values)Set the questions property of a Survey component by entering a list of questions and the accompanying values. The values must be valid variable names.
setAnswersobj​.setAnswers(​options, values)Set the values property of a Survey component (the answers) by entering a list of options and the accompanying values. options as well as values must be strings.

The example survey displayed above (but without the answers entered) can be created using:

s = component.Survey("my_survey", form)
s.label = "What is your opinion on:"
s.setQuestions(["Readability", "Support", "Performance", "Design"],
    ["read", "sup", "perf", "des"])
s.setAnswers(["Very poor", "Poor", "Neutral", "Good", "Excellent"],
    ["vp", "p", "n", "g", "e"])
s       = component.Survey("my_survey", form);
s.label = "What is your opinion on:";
s.setQuestions(["Readability", "Support", "Performance", "Design"], ...
    ["read", "sup", "perf", "des"])
s.setAnswers(["Very poor", "Poor", "Neutral", "Good", "Excellent"], ...
    ["vp", "p", "n", "g", "e"])

The resulting value of the component after filling out the survey as in the image becomes:

{
   "read": "n",
   "sup": "e",
   "perf": "g",
   "des": "p"
}

See also

  • Radio buttons are used to answer the questions.