{"id":11901,"date":"2013-09-06T14:23:54","date_gmt":"2013-09-06T14:23:54","guid":{"rendered":"https:\/\/www.snapsurveys.com\/support-snap11\/?page_id=11901"},"modified":"2018-10-04T14:30:55","modified_gmt":"2018-10-04T13:30:55","slug":"smart-reports-creating-multiple-pdf-reports-using-contexts","status":"publish","type":"page","link":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/","title":{"rendered":"Smart Reports: creating multiple pdf reports using contexts"},"content":{"rendered":"<p>This worksheet describes how to set up a Smart Report so it creates multiple pdf reports with Snap dynamically selecting the data depending on the <em>context<\/em>. It explains how to set up the survey in Snap so that it will produce all the reports that are needed, and then tells you how to set up the report instructions so that each report will be sent to a different pdf file.<\/p>\n<p>This worksheet 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 worksheet describes how to use the location in a context data set, allowing you to produce separate reports for each location.<\/p>\n<p>The example starts with the report created in the worksheet\u00a0<a href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-understanding-contexts\/\">Understanding contexts<\/a>\u00a0and shows you how to set it up so that a separate pdf file is produced for each restaurant manager, ready to be sent to them or printed out.<\/p>\n<p>The worksheet assumes:<\/p>\n<ul>\n<li>you are have worked through the worksheets:\u00a0<a href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/creating-a-smart-report-which-includes-automatic-text\/\">Creating a Smart Report which includes automatic text<\/a>\u00a0and\u00a0<a href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-understanding-contexts\/\">Understanding contexts<\/a><\/li>\n<li>you have a pdf printer driver available<\/li>\n<\/ul>\n<p><a name=\"o32030\"><\/a><\/p>\n<h3>Background<\/h3>\n<p>The worksheet\u00a0<a title=\"\" href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-understanding-contexts\/\" target=\"_self\">Understanding contexts<\/a>\u00a0explained how to change what data was used depending on the information stored in a context variable and showed you how to set the current context by using the global data set.<\/p>\n<p>The global data set allows you to set a context manually. You can also tell Snap to automatically create a report or an analysis multiple times by using a <em>context data set<\/em>.<\/p>\n<p>This worksheet shows you how to set up a simple version of a context data set. It contains a single variable (<b>Location<\/b>) and tells Snap to use the received responses to work out how many reports or analyses to create. Snap looks at the raw data file (the responses received) and sets the context in turn to every value that has been received for the specified variable. For the Crocodile survey, if you placed the\u00a0<b>Location\u00a0<\/b>variable in a context data set, this would mean that if you had received responses from New York, Boston, London, but none from Bristol, reports would only be generated for New York, Boston and London, as there would be no responses in the raw data file with a value of Bristol, UK.<\/p>\n<h3>Creating separate files with a page layout instruction<\/h3>\n<p>When you create a report in Snap it is normally sent directly to the printer driver as a single file. If you wish to create separate files for the different contexts, you must set it up so it starts each version of the report on a new page, and places it in a new file.<\/p>\n<p>The breaking up of the report is done using a\u00a0<a href=\"https:\/\/www.snapsurveys.com\/help\/21741.htm\" target=\"_blank\" rel=\"noopener\">Page Layout instruction<\/a>. This tells Snap when to start a new page and when to start a new file.<\/p>\n<p><a name=\"o32028\"><\/a><\/p>\n<h3>Summary of steps<\/h3>\n<ol>\n<li>Add the page layout instruction to your report<\/li>\n<li>Set up the context data set to create all the reports you need<\/li>\n<li>Run the report to generate the separate pdf files<\/li>\n<\/ol>\n<p><a name=\"o32014\"><\/a><\/p>\n<h3>Creating a context data set using the location variable<\/h3>\n<p>Snap can run reports for all locations if you create a\u00a0<b>Context data set<\/b>.<\/p>\n<ol>\n<li>Select\u00a0<b>File|Context<\/b>\u00a0to open the\u00a0<b>Context Values<\/b>\u00a0dialog.\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11904 alignnone\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/cont_empty1.png\" alt=\"Context Values dialog\" width=\"334\" height=\"200\" \/><\/p>\n<\/div>\n<\/li>\n<li>Click\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11837\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/add.png\" alt=\"add\" width=\"15\" height=\"16\" \/>\u00a0to\u00a0create a new context.<\/li>\n<li>The\u00a0<b>Context Data Set<\/b>\u00a0dialog appears. By default it will have a name of\u00a0<b>CX1<\/b>. Change this to\u00a0<b>CXloc<\/b>. The\u00a0<b>CX<\/b>\u00a0will identify it as a context variable, and the\u00a0<b>loc<\/b>\u00a0tells you it is the location.<\/li>\n<li>Set the\u00a0<b>Type\u00a0<\/b>to\u00a0<b>Raw data<\/b>. This uses data in the survey (the raw data file).<\/li>\n<li>Set the\u00a0<b>Label\u00a0<\/b>to\u00a0<b>Restaurant<\/b>\u00a0<b>location\u00a0<\/b>so you know what the data set it for.<\/li>\n<li>Type\u00a0<b>Location<\/b>\u00a0in the\u00a0<b>Variables\u00a0<\/b>field. This tells Snap that the contexts are all the values in\u00a0<b>Location<\/b>. (This assumes that you have changed the name of variable\u00a0<b>Q0<\/b>\u00a0in the Crocodile file to\u00a0<b>Location\u00a0<\/b>as described in the worksheet\u00a0<a href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-understanding-contexts\/\">Understanding contexts<\/a>. If you have not, do so or use\u00a0<b>Q0<\/b>.)\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11905 alignnone\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/cxloc_croc.png\" alt=\"CXloc Context Data Set\" width=\"344\" height=\"174\" \/><\/p>\n<\/div>\n<\/li>\n<li>Click\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11858\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/save.png\" alt=\"save\" width=\"21\" height=\"17\" \/>\u00a0to save the context data set. You can now use it to automatically generate multiple reports.<\/li>\n<\/ol>\n<p><a name=\"o32034\"><\/a><\/p>\n<h3><span style=\"font-size: 1.17em;\">Loop round all the context reports<\/span><\/h3>\n<ol>\n<li>Open your report if it is not open and enter\u00a0<b>CXloc<\/b>\u00a0as the\u00a0<b>Context<\/b>.\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11906\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/rp1_cont_loc.png\" alt=\"Report RP1\" width=\"420\" height=\"306\" \/><\/p>\n<\/div>\n<\/li>\n<li>Click\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11837 size-full\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/add.png\" alt=\"add\" width=\"15\" height=\"16\" \/>\u00a0on the report dialog and select\u00a0<b>Page Layout\u00a0<\/b>from the drop-down menu.<\/li>\n<li>Select\u00a0<b>Start New Page<\/b>. This ensures that each time the report is run it starts on a new page.\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11909\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/page_lay_pb_hl.png\" alt=\"Report RP1 Instruction \" width=\"386\" height=\"342\" \/><\/p>\n<\/div>\n<\/li>\n<li>If the\u00a0<b>Page Layou<\/b>t instruction is not the first instruction in the report, select it in the window and drag it to the top of the list of instructions.<\/li>\n<li>Click\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11903\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/12258.png\" alt=\"Go\" width=\"26\" height=\"24\" \/>\u00a0to run the report. The\u00a0<b>Report Execution<\/b>\u00a0dialog opens.<\/li>\n<li>Click\u00a0<b>[Printer]<\/b>\u00a0to confirm that you are printing to the pdf printer driver. Click\u00a0<b>[OK]<\/b>\u00a0to close the Print Setup dialog.<\/li>\n<li>Click\u00a0<b>[OK]<\/b>\u00a0on the\u00a0<b>Report Execution<\/b>\u00a0dialog. It will produce a single report file with four versions of the content, one for each possible value of the variable listed in\u00a0<b>CXloc<\/b>. Each one will start on a new page.\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11911\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/rep_loc_four.png\" alt=\"rep_loc_four\" width=\"448\" height=\"446\" \/><\/p>\n<\/div>\n<\/li>\n<\/ol>\n<p><a name=\"o32031\"><\/a><\/p>\n<h3>Setting up the report to create separate files<\/h3>\n<p>You need to modify the\u00a0<b>Page Layout\u00a0<\/b>instruction at the start of your report to tell Snap to save the different reports to separate files.<\/p>\n<ol>\n<li>Double-click the\u00a0<b>Page Layout\u00a0<\/b>instruction to open it.<\/li>\n<li>Select\u00a0<b>Restart Page numbers<\/b>\u00a0to ensure that each document starts on page 1.<\/li>\n<li>Select\u00a0<b>Start New Document<\/b>. 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).<\/li>\n<li>Click\u00a0<b>[Insert]<\/b>\u00a0and select\u00a0<b>Variable field<\/b>\u00a0from the list.<\/li>\n<li>Select\u00a0<b>Location<\/b>\u00a0as the\u00a0<b>Variable\u00a0<\/b>and\u00a0<b>Context\u00a0<\/b>as the\u00a0<b>Aspect<\/b>. This will use the label of the<b>\u00a0Location\u00a0<\/b>for the current context as the filename, so the report for Boston will be given a filename of\u00a0<b>Boston, MA.pdf<\/b>.\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11907\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/nvf_loc_cont1.png\" alt=\"New variable field\" width=\"203\" height=\"161\" \/><\/p>\n<\/div>\n<\/li>\n<li>Click\u00a0<b>[OK]<\/b>\u00a0to close the\u00a0<b>New Variable field<\/b>\u00a0dialog.\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11908\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/page_lay_name.png\" alt=\"Page Layout - Report RP1 - Instruction \" width=\"386\" height=\"342\" \/>.<\/p>\n<\/div>\n<\/li>\n<li>Click<b>\u00a0[OK]<\/b>\u00a0to save your instruction.<\/li>\n<li>Click\u00a0<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/12258.png\" alt=\"Go\" width=\"26\" height=\"24\" \/>\u00a0to run the report, then click\u00a0<b>[OK]<\/b>\u00a0on the\u00a0<b>Report Execution<\/b>\u00a0dialog. 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. The picture below shows the four files in PDFCreator.\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11910\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2013\/09\/pdf_crea_4files.png\" alt=\"PDF Creator - PDF Print monitor\" width=\"520\" height=\"215\" \/><\/div>\n<\/li>\n<li>Once the files have been saved, you can check that they are as you expect. Snap should have created a report for each value of\u00a0<b>Location<\/b>, and used the appropriate label as the filename.<\/li>\n<\/ol>\n<p><a name=\"o32027\"><\/a><\/p>\n<h3>Conclusion<\/h3>\n<p>This worksheet has described how to automatically change the context to create multiple versions of the report from the same data. It has also explained how to use a Page Layout instruction to create separate files, named according to the context, to store each report.<\/p>\n<p>If you would like to see other examples of using contexts see\u00a0<a href=\"https:\/\/www.snapsurveys.com\/help\/30294.htm\" target=\"_blank\" rel=\"noopener\">Using contexts to provide personalised reports and questionnaires<\/a>.<\/p>\n<p>If you would like more examples of how to lay out a report, see the list of topics at <a href=\"https:\/\/www.snapsurveys.com\/help\/#30973\">Laying out your reports<\/a>. For reference information about the page layout instruction, see the topic:\u00a0<a href=\"https:\/\/www.snapsurveys.com\/help\/index.htm#21741\" target=\"_blank\" rel=\"noopener\">Report instruction dialog: Page Layout: Page breaks tab<\/a>.<\/p>\n<p>If there is a topic you would like a worksheet on, email to <a title=\"\" href=\"mailto:snapideas@snapsurveys.com\" target=\"_self\">snapideas@snapsurveys.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><a class=\"ninja_pages_read_more\"  href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/\"><\/a><\/p>\n","protected":false},"author":10,"featured_media":0,"parent":43,"menu_order":127,"comment_status":"open","ping_status":"closed","template":"page-templates\/child-page.php","meta":{"_acf_changed":false,"footnotes":""},"class_list":{"0":"post-11901","1":"page","2":"type-page","3":"status-publish","5":"search_category-support-hub"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Smart Reports: creating multiple pdf reports using contexts - Snap Surveys<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Smart Reports: creating multiple pdf reports using contexts - Snap Surveys\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/\" \/>\n<meta property=\"og:site_name\" content=\"Snap Surveys\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SnapSurveys\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-04T13:30:55+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@snapsurveys\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/\",\"url\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/\",\"name\":\"Smart Reports: creating multiple pdf reports using contexts - Snap Surveys\",\"isPartOf\":{\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/#website\"},\"datePublished\":\"2013-09-06T14:23:54+00:00\",\"dateModified\":\"2018-10-04T13:30:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.snapsurveys.com\/support-snap11\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Worksheets\",\"item\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Smart Reports: creating multiple pdf reports using contexts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/#website\",\"url\":\"https:\/\/www.snapsurveys.com\/support-snap11\/\",\"name\":\"Snap Surveys\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.snapsurveys.com\/support-snap11\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Smart Reports: creating multiple pdf reports using contexts - Snap Surveys","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_GB","og_type":"article","og_title":"Smart Reports: creating multiple pdf reports using contexts - Snap Surveys","og_url":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/","og_site_name":"Snap Surveys","article_publisher":"https:\/\/www.facebook.com\/SnapSurveys","article_modified_time":"2018-10-04T13:30:55+00:00","twitter_card":"summary_large_image","twitter_site":"@snapsurveys","twitter_misc":{"Estimated reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/","url":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/","name":"Smart Reports: creating multiple pdf reports using contexts - Snap Surveys","isPartOf":{"@id":"https:\/\/www.snapsurveys.com\/support-snap11\/#website"},"datePublished":"2013-09-06T14:23:54+00:00","dateModified":"2018-10-04T13:30:55+00:00","breadcrumb":{"@id":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/smart-reports-creating-multiple-pdf-reports-using-contexts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.snapsurveys.com\/support-snap11\/"},{"@type":"ListItem","position":2,"name":"Worksheets","item":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/"},{"@type":"ListItem","position":3,"name":"Smart Reports: creating multiple pdf reports using contexts"}]},{"@type":"WebSite","@id":"https:\/\/www.snapsurveys.com\/support-snap11\/#website","url":"https:\/\/www.snapsurveys.com\/support-snap11\/","name":"Snap Surveys","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.snapsurveys.com\/support-snap11\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"}]}},"_links":{"self":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/11901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/comments?post=11901"}],"version-history":[{"count":10,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/11901\/revisions"}],"predecessor-version":[{"id":26655,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/11901\/revisions\/26655"}],"up":[{"embeddable":true,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/43"}],"wp:attachment":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/media?parent=11901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}