User Guide
×
Menu
Index
 

Displaying the Response Label in a Data Reference

 
The Expression Editor in Compose allows an expression to return the actual text label of the data reference.
 
 
For example, in this crosstab that includes sorted results, an expression can be used to show the name of the highest ranking response (“Alpina”) on a page.
 
To start, drag a new text field onto the page and click the EXPR option in the menu bar to open the Expression Editor.
(This example uses a text field, but a shape can also be used.)
 
Begin editing the expression and create a new data reference to the crosstab results in Query.
Since this example will display the 1st item listed, the expression is referencing the 1st position of the list of results (1 from start).
 
The expression syntax should now have a green check mark and the returned value will be “95%.”
The result of 95% is the correct 1st value in the results.
However, the objective of this example is to show the top item’s label, not the actual top value.
 
The expression syntax needs some additional editing for it to display the response label instead.
Type ‘itemat(’ at the beginning of the expression.
At the end of the expression, type ‘,1)
Lastly, click on Formatted value and change it to Response labels
The expression syntax should now have a green check mark again and the returned value will be “Ascari” which is the response label for “95%.”
 
Click the Apply button.
 
         
To perform additional edits to the expression, such as adding a text description or prefix, either click the EXPR option in the menu bar
or double-click the results inside the text field and click the pencil (edit) icon in the orange bar.
 
To add a text description that accompanies the expression response label, surround the added text with double-quotes and add a plus sign at the end of the text.
This example is adding a “1)” to identify “Ascari” as the top ranked response.
“1)”+itemat(dataReference(Ref1,Response labels),1)
 
Notice the additional “1)” text description is now included with “Ascari.”
 
In this example, additional text fields were included to show the 2nd position response label, “Shelby” and 3rd position response label, “Kopas.”
Background color was also added to all of the text fields.