Zu Hauptinhalten wechseln

FV Decipher Unterstützung

Alle Themen, Ressourcen für FV Decipher benötigt.


Using XML to Edit Crosstabs


1: Accessing the XML in Crosstabs

First, open Crosstabs for your project.

To access the XML for a saved crosstab , locate the crosstab and click Edit Crosstab.


Then click "XML".

To access the XML for a new crosstab , select "Build Crosstab".

Then click "XML".

Edit the crosstab using XML. If you are familiar with coding , this can be an easy way to edit or modify the graphical user interface (GUI). Select "Update" once you have completed your edits. Click "Cancel" to revert your code.

2: Logic syntax

Note that the XML is case sensitive.
All tags that are open must also be closed, using the forward slash (/).

2.1: XML Tags & Their Attributes

1.  <xtab>
The outer most day did Defines did you have a crosstab

<Xtab> Attributes:

  • Name - The crosstab name (default: "New Crosstab")
  • Description - The description of the crosstab (default: none)

2.  <group>
Creates a group heading and can contain multiple segments <seg>

<Group> Attributes:

  • Name - The group name (default: "New Group")
  • ShowHeader - Show or hide the group as a heading in the report table (set to true or false; default: true)

3.  <seg>
Defines a specific banner point within your custom crosstab

<Seg> Attributes:

  • Name - The segment name (default: "New Segment")

4.  <cond>
Outlines the specific logic (ie, condition) that defines your specific banner point

<Cond> Totals:

  • <Cond> (ALL) - The segment logic represents all respondents in the crosstab
  • < Cond > (ALL_IN_GROUP) - The segmentLogic represents the count / percentages of the segments within a group. Otherwise, count / percentages is based on all segments in the crosstab.

<Cond> Joiners:

  • <And />  Joins two <cond> tags with AND, which filters respondent data where both conditions must be true.
  • <Or />   Joins two <cond> tags with OR, which filters respondent data where either condition can be true.
  • <And-not />   Joins two <cond> tags with AND NOT, which filters respondent data where the first condition must be true and the second condition must be false.
  • <Or-not />   joins two <cond> tags with OR NOT, which filters respondent data.

2.2: Logic Syntax for Conditions

2.2.1: Closed-end Questions

1-dimensional single-select, multi-select or drop-down menu question:

<Cond> q3.r1 </ cond>

Checks checks "r1" which is selected in q3

2-dimensional single select, multi-select or drop-down menu question:

<Cond> q3.r1.c1 </ cond>

Checks if for r1 in q3, "c1" which is selected

<Cond> q4.r1.any </ cond>

Checks within r1 of q4 if any option was selected

<Cond> q4.but (q4.r1) .any </ cond>

Checks if anything within q4, but excluding q4.r1 was selected

Multi-select question:

<Cond> q4.count> 2 </ cond>

Checks if the number of checkboxes checked

2.2.2: Open-ended Questions

Text and Essay questions:

<Cond> Q2.search ("sometext") </ cond>

Matches Q2's textual value against this string (not case sensitive) within the question (ASCII character set only)

Number and Float questions:

<") (Q3.check ('1-100')) or (Q3.check ('> 399')) or (Q3.check ('<50')) </ cond>

Checks for items within the range, 400 and above, or less than 50

<Cond> Q5.sum> 25 </ cond>

Checks if the sum of the numeric question is greater than 25

Number questions

1 <cond>(q4.val is not None) </cond>

    Excludes empty data fields from the logic (when applicable). Otherwise empty data fields will be evaluated to "0" and included in the logic.

2.2.3: Dates

date_range(start, end) Checks if the completion date is within the range, in the server's timezone.

  • The dates can be one of "01-mar-2013", "01-mar-2013 14:32" or "01-mar-2013 14:32:00"
  • The month is case insensitive
  • The time is 24H time
  • If the end time is a day, it is assumed to be end of that day (so specifying 14-mar-2013 as end time means until 23:59:59 on that day). Leave the end of the day.
  • Use 'now' as a dynamic end date to reference "today". This logic is only available in the XML, it is not supported in the logic editor.

Example of respondents completing on 3/25/14:

<Cond> date_range ("25-Mar-2015", "25-Mar-2015") </ cond>
date_days(start, end) Checks for a rolling date range.
  • "Start" equal to 0 means beginning of today, 14 means beginning of the day 14 days ago
  • The end defaults to now if left out, otherwise it's the end of the day specified as using the start syntax
  • This syntax is not supported

Example of respondents completing the last 7 days:

<Cond> date_days (7) </ cond>

2.2.4: Nested Logic

Segment logic can use parentheses or a logic to change logic precedence, which creates nested boolean logic.

The example below shows the different ways that logic is used for mosaics ( q1.r1) which is either "A" ( q3.r1) or "is 35-44" ( q2.r4) can be entered in the XML.

Using a single condition:

<Cond> (q1.r1) and (q2.r4 or q3.r1) </ cond>

Using conditions with a logic joiner:

<Cond> (q1.r1) </ cond> 
<and /> 
<cond> (q2.r4 or q3.r1) </ cond>

2.3: Combining Tags & Conditions

The XML file is a series of nested XML tags. There is only one set of <xtab> </ strong> tags that surround all of your segments and groups.

<Xtab name = "New Crosstab"> 
  <seg name = "Total"> 
    <cond> (ALL) </ cond> 
  </ seg> 
</ xtab>

Inside each report, you must use the <seg> </ seg> and <cond> </ cond> tags to define your banners. There is one <seg> </ seg> for each bannerpoint you want to include in your report, and must include a name (name = ""). The <cond> </ cond> tags are then nested to define the logic for each banner point; You can have one or more <cond> </ cond> tags inside each <seg>, linked with the condition joiners.

<Seg name = "Male 18-34"> 
    <cond> (q1.r1) </ cond> 
    <and /> 
    <cond> (q2.r1 or q2.r2) </ cond> 
</ seg> 
<seg name = "times 44 or under"> 
    <cond> (q1.r1) </ cond> 
    <and-not /> 
    <cond> (q2.r5) </ cond> 
</ seg>

2.4: Defining the Variable Names

In the above example using the <cond> </ cond> tags, the logic was defined using the syntax (q1.r1). These references, "q1" and "r1" are specific variable names used within the survey. To find the right variable references, you can download the survey datamap, available in the download feature of the report. You can use the "direct to browser" option, which loads the datamap into your current browser. The datamap shows each question and the associated label. For more information on how to find the right report, click here .

Tip: If your project utilizes alternate (old) labels, you must reference the original question label.

2.5: Examples

The labels and conditions are used to describe the specific logic of each segment. </ P> <p> <p> <p> </ p> <p> <p> </ p>

Example datamap:

  • R1 - Male
  • R2 - Female
Please select your age range:
  • R1 - Under 18
  • R2 - 18-24
  • R3 - 25-34
  • R4 - 35-44
  • R5 - 45 or older
Which is your favorite brand?
  • 0 - Unchecked
  • 1 - Checked
  • R1 - Brand A 
  • R2 - Brand B 
  • R3 - Brand C 
  • R4 - Brand D

Example # 1

<Seg name = "Male"> 
    <cond> (q1.r1) </ cond> 
</ seg>

Example # 2

<Seg name = "Male and not (45 or older)"> 
    <cond> (q1.r1) </ cond> 
    <and-not /> 
    <cond> (q2.r5) </ cond> 
</ seg>

Example # 3

<Seg name = "Male and (Brand A or B)"> 
    <cond> (q1.r1) </ cond> 
    <and /> 
    <cond> (q3.r1 or q3.r2) </ cond> 
</ seg >

Example # 4

<Seg name = "Male and (Brand A and B)"> 
    <cond> (q1.r1) </ cond> 
    <and /> 
    <cond> (q3.r1 and q3.r2) </ cond> 
</ seg >

3: Tips & Tricks

One of the best ways to learn the proper syntax is to build out custom reports using the report builder, then go back and review the code it generated.

The XML editor will also optimize the code when you save it. You do not have to separate out the logic for the segment. If you enter:

<Cond> (q1.r1 or q2.r1) and q3.r1 </ cond>

The XML editor will save and update it to the nested logic:

<Cond> (q1.r1 or q2.r1) </ cond> 
<and /> 
<cond> q3.r1 </ cond>


  • Use CTRL + ENTER to update the XML and close the editor.