SurveyFactory Documentation Documentation One Answer per Row template variables
One Answer per Row template variables
Revision as of 23:04, 24 March 2013 by Matt (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template variables > One Answer per Row

One Answer per Row template variables are defined for each question in your survey that is of type One Answer per Row. These variables are identical to Many Answers per Row template variables. If you are looking for template variables for another question type, please see template variables. This page details the structure of the question template variables so you can know what to expect when designing your templates.

question.
   # Variables in common with all question types
   id
   type = 'MatrixRadioButtons'
   text
   instructions
   required
   number
   sortorder
   scored
   hidden
   valid
   answered
   inloop[]
   loops.
   template.
   errors[]

   # Additional variables for One Answer per Row question type
   unique_answers
   na_atleast
   na_atmost

   answerorder
   answers[]
      # Variables shared by each answer in question.answers[]
      id
      label
      value
      selected
      fixedposition
      template.

   roworder
   rows[]
      # Variables shared by each row in question.rows[]
      id
      label
      required
      noscore
      fixedposition
      f_name
      f_uniqueid
      template.

      answers[]
         # For each answer in row.answers[]
         data.
         f_value
         f_selected
         f_uniqueid

      tf.
         f_name
         f_value
         f_uniqueid

   comment_tf
   tf.
      type
      default
      label
      required
      minlength
      maxlength
      validation
      validation_type
      validation_not
      validation_case

question.

This document assumes that you have the question object in a variable named question. This is most often achieved in a loop, such as:

[% FOREACH question IN survey.questions; %]

or using a custom template function such as getQuestion:

[% question = getQuestion(id); %]

question.id

Contains the ID # of the question as listed in the survey editor. This is unique across all of your surveys and is used in getQuestion and other custom template functions.

question.type

This variable will be set to 'MatrixRadioButtons' for a One Answer per Row question type.