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
- Open the Crocodile Rock Cafe survey supplied with Snap.
- 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.
- Click to save the context.
- Before using the context check that the global context value is not set.
Running the report with sub reports
- Click to open the Reports window.
- Double click the report to open it. In this example, the Summary report is used.
- In Filter, enter the context filter, in this case Q0=Q0@context.
- In Context, enter the context data set, in this case CX1
- Click 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
- In the Report Summary, click New Instruction 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.
- Select Start New Page.
- Select Restart Page numbers to ensure that each document starts on page 1.
- 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.
- Click Insert and select Variable field from the list.
- 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.
- Click OK to insert the variable.
- Click OK to save the report instruction.
- Click 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.