This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help
Tutorial 4: Tailoring your data by using a context filter
This tutorial describes how to use contexts and filters to create a report that is tailored for a specific user. By setting a context, you can tailor the text and values in a report. By setting a filter, you can limit the data. In this tutorial, you add a list of comments to the report created in the previous tutorial: Tutorial 3: Creating tailored reports in Snap . The comments will be filtered so that they only include comments for a specific restaurant. This is done by applying a filter based on context to the list analysis.
The list analysis is added to the report , along with a short description of the list. The description includes text based on the context, allowing you to tailor it for a recipient. You don't want the description if there aren't any comments, so the worksheet explains how to add the description conditionally. The (not applicable) field holds the condition.
The power of combining contexts and filters
The example report produced in this report uses a context of location. This allows you to generate separate reports with text and a benchmark analysis appropriate to the different locations. By adding further instructions to the report with filters based on the context, you can have analyses that only include the data specific to a given location.
You can filter a whole report based on context, but in that case, you cannot use any analyses that require the whole dataset, such as a comparison between the different locations.
Adding the filter to the comments list
There is already a list analysis of comments in the Crocodile survey: .
- Click
on the Snap toolbar to open the window. Select and click
on the analyses window toolbar to copy the list. - It currently has a filter of applied. Add to filter the comments according to the current location (for each case, the value in must be the same as the current location set by the context).

- Select the tab.
- Clear the options (, and ).
- Click to create the new list.

It will be empty as no context has been applied (unless you have a global setting present in your survey).
- 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, UK.

- Click
to save the context. - Click
on the analysis window toolbar to update the list. The comments for Bristol will appear. - If you wish to check that the filter works for other contexts, open the context value and set the value for to .
- Click
on the toolbar to update the context. - Click
on the list analysis toolbar to update the list. The comments for London will appear. - Click
to save the list.
Adding dynamic text based on context
This section uses the report created in the tutorial Tutorial 3: Creating tailored reports in Snap
- Click
on the Snap toolbar to open the reports window. - Double click the report to open it.
- Click once on the last instruction in the list to select it.
- Click
on the report dialog and select from the drop-down menu to add a new instruction after the last instruction. - Enter the text "Comments received from customers at the " in the large text area.
- Use the button to open the . dialog.
- Select as the variable and set the as to insert the label of the current location.
- Finish the sentence by entering " restaurant" in the text area.

- Click to save the instruction as instruction 5.
Setting when the instruction will appear
It is possible that no comments will have been received for a restaurant. In this case, you do not want this text to appear. You can remove it by setting a condition on the instruction.
- Double-click the information instruction (instruction 5) to open it.
- Type in the field. This tests if there is currently any data in the comments list (analysis ). If there is not, the text instruction will not be used in the report.

- Click to save your changes.
Adding the comments list 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 (the comments list) from the list of analyses. - Click to add the instruction to the report.
Checking that it works
As shown earlier, if there is no context set, the comments list will be empty.
- Open your report if it is not open and clear the field (delete the ).

- Select to open the dialog.

- Double click the context value to open it. Delete the value of the variable to clear the context.
- Click
to save the context. - Change to the reports window.
- Select and click
to run it. The dialog opens. - Click to confirm that you are printing to the pdf printer driver. Click to close the Print Setup dialog.
- Click on the dialog. It will produce a single report file entitled No reply. No comments will be visible and the instruction text will not be included.

- Set the context for the report to and run the report again.
- Four reports will be included, each one with the appropriate text and comments.
