SurveyFactory Documentation Documentation Most Preferred template variables
Most Preferred template variables
ARTICLE

Template variables > Most Preferred

Most Preferred template variables are defined for each question in your survey that is of type Most Preferred. 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 = 'MostPreferred'
   text
   instructions
   required
   number
   sortorder
   scored
   hidden
   valid
   answered
   inloop[]
   loops.
   template.
   errors[]

   # Additional variables for Most Preferred question type
   answerorder

   roworder
   rows[]
      # Variables for each row in question.rows[]
      id
      required
      fixedposition
      f_name
      f_uniqueid
      template.
 
      answers[]
         # Variables for each answer in row.answers[]
         id
         label
         value
         selected
         f_value
         f_selected
         f_uniqueid
         template.

[edit] 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); %]

[edit] 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.

[edit] question.type

This variable will be set to 'MostPreferred' for a Most Preferred question type.