This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help
Tutorial 2: What is a context?
This section describes how to set up a smart report so it dynamically selects the data depending on the context. The context is a variable containing a list of possible values. The smart report will automatically produce a report for each context value.
This uses the sample Crocodile survey supplied with Snap. The survey evaluates a restaurant chain with four branches (two in the UK and two in the USA). The tutorial describes how to use the location as the context, allowing you to produce separate reports for each location.
The report will consist of a title and a bar chart comparing the current location and all locations (including the current) and other locations (all locations excluding the current location). The chart will use the name of the current location in the chart labels, so the report for Bristol, UK will have a chart comparing Bristol to all locations, and the report for Boston, US will have a chart comparing Boston to all locations.
Give your variables sensible names
It makes life much simpler if your variables have meaningful names.
- Open the Crocodile survey supplied with Snap.
- Click
on the Snap toolbar to display the Variables window. - Find in the window.
- Double-click it to open the variable details.
- Change the from to . (You can safely do this as the name does not appear in the questionnaire.)

- Click
to save the changes.
Set up the derived variable
This step shows how to set up a derived variable which compares data from the current location (the context) to all data. The variable will derive its labels as well as its data from the context variable.
- Click
on the Variables window toolbar to add a new variable. - Specify the Variable details:
Name: CComparison
Label: Compare context to all
Type: Derived (the variable will derive its data from , the existing location question).
Response: Multiple (each respondent will fall into two cases).
- Double click in the first code label and click the ] button. Select from the drop-down list.

- Select as the , and as the . This will give the selected location as the code label. Press to return to the variable definition.

- Press [Tab] to move to the column. Enter . The code used will be the code that equals the location specified by the context.
- Press [Tab] to move to the next field and enter . Then enter as the . This code will be used when the response does not equal the location specified by context.
- Press [Tab] to move to the next field and enter . Then enter as the .

- Click
to save the context.
Create the comparison bar chart
This step describes how to set up a chart of the average spend at one restaurant against the other restaurants. You can find out more about means in Snap from the topic .
- Click
to display the dialog for a chart. - Select the chart style from the drop-down list.
- Type (your derived variable) into the field.
- Check the box.
- Select from the list and enter as the variable to use.

- Change to the tab and click in the field
- Enter the title of your chart, using the button to open the . dialog and insert the of and the of in the title.

- Clear the titles.

- Select the tab.
- Clear the options (, and ).
- Click to see your chart.

It will have no data for the subject as no context has been set.
- Select to open the dialog.

- Double click the context value to open it. This allows you to set the context to a specific value.
- Set the to and the to . This sets the current context to Bristol.

- Click
to save the context. - Click
on the chart toolbar to update the chart. The context information will appear.
Put the bar chart in a report
The report will contain the title and the comparison bar chart.
- Click
on the Snap toolbar to open the reports window. - Click
to create a new report. By default this will have a instruction in and nothing else. - Add a label to your report so you know what it contains (e.g. Benchmark data by location).
- Click
on the report dialog and select from the drop-down menu to add a new instruction. - Enter the title for your report in the text pane. Leave the field blank (this is the title of the .). Style your title text by selecting text and using the format buttons.

- Click to save the instruction.
Add the benchmark chart to your report
- Click
on the report dialog and select from the drop-down menu to add a new instruction. - Click
on the dialog and select the comparison chart from the list. - Click to add the instruction to the report.
- Click
to save the report. - Run the report