We have a template with two print context sections. We need to create output files for both separately but from the same data. Is this possible?
I think it should be possible; but the best way to achieve this depends on what these sections are. For instance are they two different types of documents (Ex: Invoice and Statement), yet using the same data? Or is it a single document type with two parts with a clear field distinguishing both parts?
Consider your standard Connect print output:
Execute Data Mapper > | Create Print Content > | Create Job > | Create Output |
Execute Data Mapper > | Create Print Content > | Create Job > | Create Output |
Create Print Content > | Create Job > | Create Output |
Now the tricky part… you want to use the same template. Which means you’ll have to tell the Create Print Content step which one to use. Well, if you make those sections show/hide conditionally based on a field, lets say ExtraData, then just before you step into the Create Print Content in each branch, you can use the Metadata Fields Management task to add a value into ExtraData which will control which section gets displayed.
Controlling it through the metadata in this way will require 2 more steps, however. First, when you Execute the datamapping, you need to check the Output Records in Metadata so that you have access to the ExtraData field. Second, in your Create Print Content, you need to check the box to Update Records from metadata. This will take that value that you’ve just put in the metadata, update the datamapping with it, and use that new datamapping for the Create Print Content step.
There you have it. Same data, same template, 2 different outputs from 2 different sections. I hope this was clear enough to follow.
Yes, you can. One output will need to branch out separately from the main branch. See the graphic below for a representation of what it may look like and the plugins used.