Requires Decipher Cloud
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 DQs 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 DQs from the style library. To learn more about the XML style system, or for a quick refresher, click here.
1: 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:
Note: You can click on the file names in blue for more information.
styles.xml-- this is an XML file very similar to our
survey.xml, but can only house style definitions for the DQ, containing
<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.
meta.xml-- this file contains the rules for our DQ, such as setup restrictions, Builder menu support, question types, templates, compat levels, and required question attributes.
code.py-- this more advanced file allows for the application of some onLoad functions whenever the DQ is used. Currently, the usage of that file is limited to FocusVision-created system DQs.
res.xml-- custom language resource overrides for the DQ will be stored in here (e.g., what system error messages will be changed).
Click here to download example files for a blank DQ.
2: Where to Put DQ Files or Find Existing DQs
You can search for and store new or updated DQ styles in the following locations:
lib/local/dqname/v1: Global DQs -- these are DQs that will apply to all companies on a server
selfserve/hashcode/lib/dqname/v1: Company/folder-specific DQs -- these are DQs that will apply to a single company on a server
lib/steam/xxxx-- FocusVision-created standard DQs, This is a version-controlled location where all standard FocusVision-created DQs are stored. These will apply server wide and can only be added to or modified by FocusVision staff.
3: Additional Considerations
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.
3.2: 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.
4: 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 DQs 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:
For example, if you wanted to call a “Star Rating” DQ, you would use the following command:
Note: 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 DQs 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">