{"id":106,"date":"2015-01-30T13:13:18","date_gmt":"2015-01-30T18:13:18","guid":{"rendered":"http:\/\/salzlechner.com\/dev\/?p=106"},"modified":"2016-03-11T07:10:42","modified_gmt":"2016-03-11T12:10:42","slug":"vpe-for-vdf-combining-documents","status":"publish","type":"post","link":"http:\/\/salzlechner.com\/dev\/2015\/01\/30\/vpe-for-vdf-combining-documents\/","title":{"rendered":"VPE for VDF &#8211; Combining Documents"},"content":{"rendered":"<p>Lets say you need to create a combined PDF document that contains a letter, multiple reports and a graph all created from different database files<\/p>\n<p>VPE for Visual DataFlex contains a feature to help a developer with this.<\/p>\n<p>By default each VPE Report or document creates its own VPE document object that can be printed, previewed, saved, etc.<\/p>\n<p>There is a feature in VPE for VDF that allows the developer to instruct VPE for VDF to instead of creating a new document append the new document or report to an existing document<\/p>\n<p>Say we have a report called oLetterToClient and a report called oCustomerOpenInvoices as well as a chart called oCustomerSalesChart.<\/p>\n<p>We could use the following code to create a combined document<\/p>\n<pre class=\"lang:default decode:true \">\/\/ run the first report\r\n\/\/ this will create a new VPE document\r\nSend StartReport to oLetterToClient \r\n\r\n\/\/ advance to the next page\r\nSend DoVpePageBreak to oLetterToClient\r\n\r\n\/\/ tell the next report not to create a document\r\n\/\/ but to simply use the one we created earlier\r\nSet pbCreateDocument of oCustomerOpenInvoices to false\r\nSet pbShareDocumentFromDisplay of oCustomerOpenInvoices to true\r\nSet phoDocumentDisplay of oCustomerOpenInvoices to oLetterToClient\r\nSend StartReport to oCustomerOpenInvoices\r\n\r\n\/\/ advance to the next page\r\nSend DoVpePageBreak to oLetterToClient\r\n\r\n\/\/ and the same with the next report\r\nSet pbCreateDocument of oCustomerSalesChart to false\r\nSet pbShareDocumentFromDisplay of oCustomerSalesChart to true\r\nSet phoDocumentDisplay of oCustomerSalesChart to oLetterToClient\r\nSend StartReport to oCustomerSalesChart\r\n\r\n\/\/ now we have a combined document in oLetterToClient\r\nSend DoVpePreviewDoc to oLetterToClient VPE_SHOW_NORMAL\r\n\r\n<\/pre>\n<p>if you just want to call the same report or document multiple times and append them together into a single document that is even easier<\/p>\n<p>the first time you run the report or document set the\u00a0pbCreateDocument property to true and then for any subsequent runs set it to false. This will create a new document the first time. Make sure to call DoVpePageBreak to advance the page<\/p>\n<pre class=\"lang:default decode:true \">\/\/ run report the first time\r\nSet pbCreateDocument of oMyReport to true\r\nSend PreviewReport TO (oVpeDocument(Self)) VPE_SHOW_NORMAL\r\n\r\n.. change selections, etc\r\n\r\n\/\/ advance page\r\nSend DoVpePageBreak to oMyReport\r\n\r\n\/\/ run report again but into same document\r\nSet pbCreateDocument of oMyReport to false\r\nSend PreviewReport TO (oVpeDocument(Self)) VPE_SHOW_NORMAL\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>this post shows how to combine multiple reports and documents into a single document<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","ngg_post_thumbnail":0,"footnotes":""},"categories":[6,23],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-dataflex","category-vpe-for-vdf"],"_links":{"self":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":4,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":283,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/106\/revisions\/283"}],"wp:attachment":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}