This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help

Next Topic

Book Contents

Book Index

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 RP1, 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 N/A (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: AN7.

  1. Click Results window button on the Snap toolbar to open the Analyses window. Select AN7 and click Clone button on the analyses window toolbar to copy the list.
  2. It currently has a filter of Q8 ok applied. Add and Location=Location@context to filter the comments according to the current location (for each case, the value in Location must be the same as the current location set by the context).

    RD: base labels tab with report include area highlighted

  3. Select the Base/Labels tab.
  4. Clear the Reports Include options (Description, Notes and Title).
  5. Click [OK] to create the new list.

    Semantic Scale grid example stats definition

    It will be empty as no context has been applied (unless you have a global setting present in your survey).

  6. Select File|Context Values to open the Context Values dialog.

    Global context variable dialog

  7. Double click the global context value to open it. This allows you to set the context to a specific value.
  8. Set the Variable to Location and the Value to 1. This sets the current context to Bristol, UK.

    Global context variable dialog: location bristol

  9. Click Save button to save the context.
  10. Click 1 2 3  button on the analysis window toolbar to update the list. The comments for Bristol will appear.
  11. If you wish to check that the filter works for other contexts, open the global context value and set the value for Location to 2.
  12. Click 1 2 3  button on the Global Context toolbar to update the context.
  13. Click 1 2 3  button on the list analysis toolbar to update the list. The comments for London will appear.
  14. Click Save button to save the list.

Adding dynamic text based on context

This section uses the report RP1 created in the tutorial Tutorial 3: Creating tailored reports in Snap

  1. Click Batches button on the Snap toolbar to open the reports window.
  2. Double click the report RP1 to open it.
  3. Click once on the last instruction in the list to select it.
  4. Click New button on the report dialog and select Information from the drop-down menu to add a new Information instruction after the last instruction.
  5. Enter the text "Comments received from customers at the " in the large text area.
  6. Use the [Insert] button to open the Variable field... dialog.
  7. Select Location as the variable and set the Aspect as Context to insert the label of the current location.
  8. Finish the sentence by entering " restaurant" in the text area.

    Information instruction showing context

  9. Click [OK] 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 N/A condition on the instruction.

  1. Double-click the information instruction (instruction 5) to open it.
  2. Type AN18 empty in the N/A field. This tests if there is currently any data in the comments list (analysis AN18). If there is not, the text instruction will not be used in the report.

    Information instruction showing context

  3. Click [OK] to save your changes.

Adding the comments list to your report

  1. Click New button on the RP1 report dialog and select Execute from the drop-down menu to add a new Execute instruction.
  2. Click on the Execute dialog and select the AN18 (the comments list) from the list of analyses.
  3. Click [OK] to add the Execute instruction to the report.

Checking that it works

As shown earlier, if there is no context set, the comments list will be empty.

  1. Open your report if it is not open and clear the Context field (delete the CXloc).

    Default summary report with context filter applied

  2. Select File|Context Values to open the Context Values dialog.

    Global context variable dialog

  3. Double click the global context value to open it. Delete the value of the Location variable to clear the context.
  4. Click Save button to save the context.
  5. Change to the reports window.
  6. Select RP1 and click Play/run button to run it. The Report Execution dialog opens.
  7. Click [Printer] to confirm that you are printing to the pdf printer driver. Click [OK] to close the Print Setup dialog.
  8. Click [OK] on the Report Execution dialog. It will produce a single report file entitled No reply. No comments will be visible and the instruction text will not be included.

    Smart reporting: image of

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

    Smart reporting: image of

See Also

Tutorial 1: Inserting dynamic text from analyses in reports

Tutorial 2: What is a context?

Tutorial 3: Creating tailored reports in Snap

Tutorial 5: Creating a simple context report and assigning it to associates