SurveyFactory Documentation Documentation Dates and Times template variables
Dates and Times template variables

Template variables > Dates and Times

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

   # Additional variables for Dates and Times question type
   answerorder
   answers[]
      # Variables for each answer in question.answers[]
      id
      label
      required
      fixedposition
      input.
         year, month, day, hour, minute, second, ampm
      default.
         year, month, day, hour, minute, second, ampm
      restrict_after.
         year, month, day, hour, minute, second
      restrict_before.
         year, month, day, hour, minute, second
      f_name.
         year, month, day, hour, minute, second, ampm
      f_value.
         year, month, day, hour, minute, second, ampm
      f_uniqueid.
         year, month, day, hour, minute, second, ampm
      template.

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 'DateTime' for a Dates and Times question type.