In this article
1: Overview
CSV templates allow you to define a template specifying which variable(s) should be included or excluded (in CDL), and in which order. A CSV template does not allow you to control the specific column positions of the variables, only the order in which they are to be exported.
You can create CSV templates using the user interface and select exactly which variables to include in your export. These templates can also be used in the Data Viewer to present survey results.
2: Configuring Template Settings and Variables
After Creating a New Export Template, you can start configuring the template settings and variables.
Type a name for your template into the Template Name field.
-
Configure the variable settings. The options here are irreversible, so if you change your mind, you will need to cancel and create a new template from scratch.
Multi handling: Split Multis - Enable "Split Multis" to create separate columns for each multi-option in the survey. For all multi-select questions stored as Bitstring variables, logical variables will be automatically generated from each answer option. For example, a Multi question q5 with three answer options (1, 2, 99) will generate three logical variables (q5_1, q5_2, q5_99). These generated logical variables can be placed in the survey template either by repositioning them manually or by assigning them to specific positions. This setting applies globally to all multi-select questions in the survey.
-
Loop handling: Flatten loops - Enable Flatten Loops to convert looped survey questions into standard variables. This expands loop data into separate variables for each iteration, simplifying the dataset to a single level.
Note: Templates with this setting can’t be used in the Data Viewer. Data: Include respondent data - Enable "Include Respondent Data" to add respondent data to the template. Note that templates with this option are restricted to use in the data viewer.
Export options - Toggle this setting on to export data using fixed-width formatting. This format sets a specific number of character positions for each variable, making it easier to import the file into systems that require structured layouts. To learn more, visit Creating a Fixed-Width Data Template.
3: Managing and Selecting Variables for Your Template
1 All Variables in Current Level - The left column lists all the variables available in the survey. A search bar is provided at the top for easy filtering.
2 Selected Variables from Current Level - The right column displays the variables that are included in the template.
3 Include All Variables - Clicking this button selects all the variables from all the levels, adding them to the template.
4 Clear All Variables - Clicking this button de-selects all the variables from all the levels, removing them from the template.
5 Filter Variables - Opens a dialog that allows you to filter the variables in both columns based on their type.
Add the variables you want to include in the template by moving them from the left column into the right column. There are several ways of doing this:
You can click the + Add All button to move all the variables simultaneously.
You can select individual or multiple variables in the left column and click the + Add button to move the selected variables.
You can select individual or multiple variables in the left column, then click on one of the selected variables and drag them to the right column. Note that when multiple variables are selected then the number of variables being moved in indicated beside the drag field.
In the event variables are moved to the right column in error, select then in the right column and click the - Remove button.
Reorder the variables as necessary by dragging and dropping.
-
When the template is ready, click the Create button.
Tip: To use the template when exporting data (go to Exporting the Survey Data for more information) and to use the template to present response data (go to Response Data for more information).
4: Dynamic Data Templates
4.1: About Dynamic Data Templates
Dynamic Data Templates are constructed using CDL and can be created without the need to reference specific variables.
You can use filter functions to select groups of variables efficiently, and include or exclude variables using filter functions, or by referencing QIDs.
4.2: Creating a New Dynamic Data Template
To access Dynamic Data Templates, follow these steps:
In Survey Designer, click on the "Data" Tab in the top ribbon.
Click the "Data Templates" icon from the sidebar.
Click the Create New Template button.
Click the Create using CDL button to access the CDL editor. Create using UI will enable the list again.
Enter your Custom CDL Code (refer to examples below).
Click the Create button.
4.3: CDL Examples
4.3.1: CDL Example A:
config dataTemplate {
linkedSurveyId: p1000453
label: "My data template"
variableSet {
table: response: // Loop level
variables: :q1, :q2, :q3,
category("demographic"),
type("multi" ,"single"), !:q10 // ! Means exclude
}
variableSet {
table: l1: // Loop level
variables: :l1, :q41 // Note the colon before
the variable name
}
}
4.3.2: CDL Example B:
config dataTemplate {
linkedSurveyId: p924999938535
label: "Complex data template"
variableSet {
table: response: variables:
system(),!:respid, !:lastchannel, !:lastdevicetype, !:la
strenderingmode, !:last_touched, !:first_question_on_las
t_page_displayed,category("demographic"),
type("multi","text"), !:gender,:respid
}
variableSet {
table: carLoop: variables: :features,:options
}
variableSet {
table: optionLoop: variables: all()
}
4.4: Available Filter Functions and Type Names
4.4.1: Filter Functions
Filter function |
Parameters |
Description |
all |
none |
Selects all variables from a table |
background |
none |
Selects all background variables |
category |
string[] - list of categories |
Selects all variables with the specified question categories |
normal |
none |
Selects all normal variables |
system |
none |
Selects all system variables |
type |
string[] - list of variable types |
Selects all variables of the specified types. See list of supported types in table below |
4.4.2: Type Names
Type name |
Returns |
single |
all standalone single variables including standalone rating ones. |
multi |
all multi variables |
date |
all date variables |
opentext and text (as short alias) |
all standalone open text variables and all "Other specify" variables |
numeric |
all standalone numeric variables |
rating |
all standalone single variables with scores |
geolocation |
all geolocation variables |
grid |
all sub-variables of all grid questions |
numericlist |
all sub-variables of all numeric list questions |
opentextlist and textlist (as short alias) |
all sub-variables of all open text list questions |
ranking |
all sub-variables of all ranking questions |
ratinggrid |
all sub-variables of all grids with scores |
other |
all the "Other specify" variables |
audio |
all audio questions |
video |
all video questions |
image |
all image questions |
multimedia |
all multimedia questions both audio, video and image |