This article covers these topics:
Introduction
This article describes the code structure used by QMob. Please refer to the code editor for details of viewing your and editing your survey's code.
Survey code
The top-most item is the survey itself; clicking this allows you to view and edit the code for the survey as a whole.
The <survey> tag describes a survey, and contains a list of questions and items belonging to that survey.
Survey attributes
|
Attribute |
Description |
|
status |
The survey status (see project status). |
|
name |
The survey name. |
|
theme |
The ID of the theme if a custom theme has been defined on the project. |
|
icon |
The ID of the icon if a project icon has been set on the project. |
|
description |
A free text description of the survey. |
|
job_number |
An optional reference code that can be used to refer to the project when communicating with the QMob Team (it is also the main reference for project billing). If you leave this option empty, QMob will generate an automatic unique number. If you try to use a job number that has been used before, QMob will warn you, but you can still proceed with it if you wish. |
|
type |
The project type (indicated whether it is a survey or diary project). |
|
track_gps |
Saves the GPS coordinates of the respondent when the entry was made if the app has been granted access to device location. |
|
default_language |
The language the survey is scripted in; this language will be used for all respondents if no other translation is provided. |
|
survey_priority |
Controls the order of the project in the app. |
|
auto_advance |
If "true", the respondent will automatically be moved on to the next question as soon as they tap an answer to a single-coded question (i.e. without the need to tap next). |
|
allow_web_display |
If "true" the survey can be taken on any supported browser; if this option is selected, respondents will not need to have the app or log in to take part. See Web Surveys for further information and limitations. |
|
back_button_disabled |
Disables the back button on survey level meaning the respondent cannot go back to a previous question. This can also be controlled on question level from the question options. |
|
survey_discard_paused |
If "false", this allows users to keep their paused entries when the project is updated. Use this if you have project database that will be updated regularly after going live. Be careful! you should not use this if the changes must take effect immediately. |
|
terminate_participation_upon_quit |
For Survey projects. When "true", and the respondent Quits in the middle of the entry, the survey will disappear from the app. When "false", the survey will remain accessible in the app. |
|
override_newly_added |
The project will appear under My Projects in the app right away instead of first showing up under Newly Added. For more information see Project List (Home Screen) in the app. |
|
id |
The ID of the survey, managed by the system. |
|
start_publish |
The time at which this survey should become available to respondents, expressed in the following format: "dd.MM.yyyy HH.mm.ss". |
|
stop_publish |
The time at which this survey should go offline (i.e. not be available to respondents anymore). |
Survey Example
<item id="1"/>
<item id="2"/>
<folder name="My folder of randomized questions" alias="folder1" order="randomize">
<item id="3"/>
<item id="4"/>
<item id="5"/>
</folder>
<item id="6"/>
</survey>
For further information, see project properties.
Folder code
For more information on each attribute, see using folders in script.
Question code
The left-hand pane in the code editor shows alias for each question. When you click a question alias, you can edit any of the question details in the right-hand pane.
You can edit the choice texts, and any of their attributes, except for the IDs.
<question type="...">
A question is an abstract base type used for questions inside a survey.
|
Attribute |
Description |
|
id |
The question ID. This must be an integer value and is usually managed by the system. |
|
alias |
A text string that can be used as an alternate ID for the question. |
|
type |
Specifies the question type, for example text for a text question or info for an information screen. |
|
text |
The question text shown to the user. |
Choice code
Defines a choice in a single-choice or multi-choice question.
|
Attribute |
Description |
|
id |
The numerical ID for this choice. |
|
label |
The choice's label text. If this attribute is not set, but the text attribute is, then the compiler will move the text value to the label. |
|
text |
Optional text that can be used to give more detailed text for a choice. (Optional) |
|
alias |
An alias (alternative label) for the choice. (Optional) |
|
icon |
The resource ID of an image that will be displayed beside this choice. (Optional) |
|
selected |
A flag that controls whether the choice is initially selected or not. The default value is false. |
|
anchored |
A flag that controls whether the position of this choice should be fixed even if the choice order is randomized. (Optional) |
|
exclusive |
A flag that controls whether this choice can be combined with other choices. Applies only on choices in multiple-choice questions. (Optional) |
|
always_shown |
A flag that can be used to override the setting "Show filtered choices only" and make a choice show among the filtered choices even if it doesn't match the typed characters. The default value is false. |
Adding comments to your script
You can add comments to your script, in order to help you keep track of the survey logic, and to make it easier for your co-workers to understand your script. You can add in comments (notes) to any part of the script using the tag <note>.