Generating multiple reports using a context

Running a report to a context produces multiple reports – one for each possible code for that context.

This can be used to:

  • create one large report containing multiple versions of the report, one for each context
  • create a separate PDF for each iteration of the context

The examples use the Crocodile Rock Cafe survey that is supplied with Snap.

Creating the Context Data Set

  1. Open the Crocodile Rock Cafe survey supplied with Snap.
  2. Set up your Context Data Set. For this example, it uses the single variable Q0 (the location question) as the context. This enables you to automatically create a report for each possible value of location.
Context data set
  1. Click SaveIcon.png to save the context.
  2. Before using the context check that the global context value is not set.

Running the report with sub reports

  1. Click ReportsIcon.png to open the Reports window.
  2. Double click the report to open it. In this example, the Summary report is used.
  3. In Filter, enter the context filter, in this case Q0=Q0@context.
  4. In Context, enter the context data set, in this case CX1
Report details showing a context and context filter
  1. Click Run button to run the report. This produces a single report containing one sub-report for each possible value of the context.

Running the report to create multiple PDFs

  1. In the Report Summary, click New Instruction NewSurveyIcon.png to add a new Page Layout instruction. Alternatively, you can edit an existing Page Layout if there is one at the beginning of the Report.
  2. Select Start New Page.
  3. Select Restart Page numbers to ensure that each document starts on page 1.
  4. Select Start New Document. This places the report in a new file, so each time it creates the report for the different context, it will start a new file.
  5. Click Insert and select Variable field from the list.
  6. Select the context variable, for example Q0, as the Variable and Context as the Aspect. This will use the label of the Location for the current context as the filename, so the report for Boston will be given a filename of Boston, MA.pdf.
Insert a new context variable field
  1. Click OK to insert the variable.
Page layout instruction starting a new report document for each context
  1. Click OK to save the report instruction.
  2. Click  Run button  to run the report then click OK on the Report Execution dialog. Depending on the PDF driver that you are using, and the way it has been set up, it will either automatically save or ask you to save the files.
Contents