Help Center

CSL – Report Variables

CheckMarket offers a powerful scripting language to enhance your surveys and reports called the CheckMarket Scripting Language or CSL for short.

You can use it to place variables in your surveys and reports by selecting them from a drop-down.

This article lists the extra variables available in the ReportBuilder. Many of the Survey variables can also be used in the ReportBuilder, specifically the Survey, Questions and Results sections. These variables are not listed here, please refer to the Survey variables article for those.

Survey report variables

List of ReportBuilder variables

VariableDescription
{{report.id}}
ID of the report
{{report.name}}
the report name: this is mostly for internal use, but it’s also shown in the Report Viewer if no title is specified
{{report.title}}
title for the Report Viewer
{{report.language}}
the active language of the report
{{report.filter.name}}
the name of the global report filter
{{report.prebuiltFilter.name}}
the name of the selected prebuilt filter – only available in the Report Viewer, inside elements
VariableDescription
{{share.name}}
name of the share you’re accessing – the name refers to the filter of the share
VariableDescription
{{report.elements}}
a collection of all the elements in the report – used mostly in ‘each‘ loops
{{report.elements.id-123}}
reference to the element with ID 123
{{element}}
reference to the current element – short for {{report.elements.id-[current element id]}}

No matter which way you access your element, the next variables can always be used. We’ll describe them using the {{element… prefix, but you safely replace that with {{report.elements.id-123…

VariableDescription
{{element.id}}
ID of the report element
{{element.orderNumber}}
order in which the element appears in the report
{{element.title}}
the title of the element
{{element.shortName}}
the short name, used in the index on the left
{{element.comment}}
the comment of the element – this is the text you can add below the chart
{{element.data}}
a collection of all data sources inside this element – everything that can be found under the Data tab inside the ReportBuilder
{{element.data.1}}
a reference to the first data source of this element
{{element.data.1.name}}
name of this data source – either the question caption, or metadata name (respondent field or contact field)
{{element.data.1.question}}
a reference to the question of this data source – all question variables can be found in the article about the Survey variables
{{element.data.1.metadata}}
the name of the metadata used in this data source (respondent field or contact field)
{{element.data.1.filter.name}}
the name of the filter used in this data source
{{element.statistics}}
a collection of the statistics of this element – this is what you can see below the chart if you enable Statistics in the element options
{{element.statistics.1}}
a reference to the first item of the element statistics
{{element.statistics.1.label}}
the text of this stat
{{element.statistics.1.respondentCount}}
the number of respondents for this stat
{{element.statistics.1.count}}
the count for this stat – for most charts this is equal to the respondent count
{{element.statistics.1.avg}}
the average value for this stat
{{element.statistics.1.nps}}
the NPS score for this stat
{{element.statistics.1.min}}
the minimum value for this stat
{{element.statistics.1.max}}
the maximum value for this stat
{{element.statistics.1.sum}}
the sum for this stat
{{element.statistics.1.median}}
the median value for this stat
{{element.statistics.1.stdev}}
the standard deviation value for this stat
{{element.statistics.1.var}}
the variance for this stat

Operators

CSL offers a wide range of operators to further customize your reports. A complete list of CSL operators can be found here.

Inside reports, modal windows and tooltips can be useful. See the following article for more examples and information:
Tooltips, popovers and modal windows

Examples

You can combine all these variables and operators to create more advanced logic. Below you can find some ready-to-use CSL code snippets for different situations. Each snippet can be used immediately, or you can tailor it further to your own specific situation.

More examples can be found here:
Survey CSL snippets

This example shows how to show different text when your filtered ratings are better or worse than the global (benchmark) ratings.

  1. First go to ‘Analyze’ > ‘Reports’. Either make a new report or open an existing report.
  2. Create a ‘Column/bar’ element for a rating scale or NPS question.
  3. Go to the ‘Data’ tab, and apply a filter to this element. You can also apply a global report filter if you prefer.
  4. Also on the ‘Data’ tab, click ‘Add’ > ‘Benchmark’. Now your data is ready for the CSL.
  5. Go to the ‘Text’ tab, and add this to the comment field:
{{#if (lt report.elements.id-123.statistics.1.avg report.elements.id-123.statistics.2.avg)}}
  The score of your department is lower than the company average.  
  Here are some tips and action points to improve your score: ...
{{else if (gt report.elements.id-123.statistics.1.avg report.elements.id-123.statistics.2.avg)}}
  Your department is doing better than the company average. Way to go!
{{else}}
  The score of your department is just on the company average, that is to say that you are better than half of the departments!
  However, this also means that you score worse than the other half of the departments. Via the following action points you can be among the best in the company in the future: ...
{{/if}}

These variables all begin with ‘report.elements.id-123…‘. Replace 123 with the actual report element ID. You can find this ID in the URL when selecting an element.

That’s it. Now a different message will be shown to the viewers, based on the results.

Leave a Reply

Your email address will not be published.