Skip to main content

Decipher Support

All the topics, resources needed for Decipher.

FocusVision Knowledge Base

How to Create a Dynamic Question (DQ)

  Requires Decipher Cloud  

Overview

 


This is a reference guide for creating a Dynamic Question (DQ) using the “style library”. The library was created to allow for a complex question style to be centrally defined and then easily accessed in any survey. It stores all DQ's that have been or will be developed for use in a Decipher survey.

A good understanding of the XML style system is required for creating and using DQ's from the style library. To learn more about the XML style system, or for a quick refresher, click here.

What Files Make Up a DQ?

In order to create or edit a DQ, you will first need to understand what files are needed to use or create one. There are a few required files for each DQ created within our system - if you are creating a new DQ, you will need to create the following files for it within the style library.

meta.xml

Meta XML Thumbnail.png

The meta.xmlfile contains the rules for our DQ, such as setup restrictions, Builder menu support, question types, templates, compat levels, and required question attributes.

styles.xml

Styles XML Thumbnail.png

The styles.xml file is an XML file that is very similar to our survey.xml, but it can only house style definitions for the DQ, containing <style>, <stylevar> and <include> tags. When a DQ style is applied to a question, this file overrides the existing XML style for it and these tags are effectively inserted as if they were specified within the question or globally.

Static Folder

Static Folder Thumbnail.png

The static folder stores any external static files that are necessary for and private to the DQ style (e.g., CSS or JavaScript files).

res.xml

RES XML Thumbnail.png

The res.xml file contains custom language resource overrides for the DQ will be stored in here (e.g., what system error messages will be changed).

code.py

Some DQ's may also contain a code.py file. The code.py file allows for the application of some onLoad functions whenever the DQ is used, and is limited to FocusVision-created system DQ's.

Examples

Click here to download example files for a blank DQ.

Where to Put DQ Files or Find Existing DQ's

You can search for and store new or updated DQ styles in the following locations:

  • lib/local/dqname/v1: Global DQ's -- these are DQ's that will apply to all companies on a server

  • selfserve/hashcode/lib/dqname/v1: Company/folder-specific DQ's --  these are DQ's that will apply to a single company on a server

  • lib/steam/xxxx -- FocusVision-created standard DQ's, This is a version-controlled location where all standard FocusVision-created DQ's are stored. These will apply server wide and can only be added to or modified by FocusVision staff.

Additional Considerations

Versioning

Any time edits are made to a live version of a DQ, those edits should be created within a new version. This is because multiple surveys can be utilizing any DQ at any time, and updates will need to be applied manually to each instance. By creating a new version, you will not overwrite code potentially in use by another live survey.

Adding Demos

It is recommended to put an active survey.xml file in the same directory which can be used to demonstrate the style. A demo should use all options the style provides, and a showSource="1" flag on each question should display the source for that question immediately before it appears.

Calling a DQ in Your Survey

 

Once you’ve created or updated a DQ, you will likely want to use it in a survey. To call a DQ style in a survey.xml, you will need to know either its XML reference, which is a combination of its XML style name and LIVE version number. You can find XML references for all of our current DQ's here.

Once you know the XML reference for your DQ, you can call it in the survey.xml file using the below uses attribute, where the “xxxx” is the XML style name for the DQ and “yy” is the LIVE version number:

<radio uses="xxxx.yy">

For example, if you wanted to call a “Star Rating” DQ, you would use the following command:

<radio uses="starrating.5">

The first location with a DQ’s XML Style Name will be used. Then, a subdirectory will be searched, based on the version number specified. If there is no matching version directory, the system will error out (it will not try to find the version in any other location).

You can also call multiple non-conflicting DQ's by separating their XML references with a comma. For example, if you wanted to call both a “Form Image Replacement” (fir) and a “This or That” (leftright) DQ, you would use the following command:

<radio uses="fir.2, leftright.1">
  • Was this article helpful?