Back to all How-tos

Adding a cover page with data at any level

This How-To describes a more advanced technique that requires some work with different modules offered by Connect.

Using the standard tools offered in the Output module, it is currently only possible to add Blank cover pages between separate groups at different levels. It’s not possible, using these tools, to add data to that cover page.

This method has the advantage of completely customizing the cover page. However, it does have its drawback: When using this method, you cannot filter or sort your data using Job Presets! This is because the cover page is added during Content Creation and is technically part of a single record – if the record is filtered out or moved, the cover page will follow.

With that limitation in mind, let’s list the inventory of what resources are necessary for this solution to work:

  • Some data from which to create document records
  • A Data Mapping configuration
    • It needs to contain at least one field (i.e. coverpage_rqd) to trigger the cover page in the document, and additional field for any piece of data not in the record that you would like to add.
  • A Connect Designer Print Context template.
    • It needs to contain a cover page called “CoverPage“, which has to appear first (before any other regular section)
    • A Control Script that shows (or hides) the cover page depending on the field mentioned above.
  • A Workflow configuration
    • It needs to contain a process that modifies the metadata to set the trigger field (i.e. coverpage_rqd) and fill in any additional detail. This uses the Metadata Tasks.

Step 1: Adding the fields to the data mapping configuration

For this trick to work, we need to add fields to the data model used in the template. This is very straightforward and can be done to any existing configuration:

  1. Open your existing data mapping configuration (or the one supplied above)
  2. Right-click on the record header and click Add a field
  3. Enter a name for the field, for example coverpage_rqd
  4. Right-click on the new field and choose Set type then Boolean
  5. Right-click again on the field and choose Default Value. Set it to true

If any additional data is required, simply create new fields of the appropriate type and a default value to test it. For instance, I created a Coverpage_DocumentCountwhich indicates the number of documents that are in the job or group, with the Integer type.

Step 2: Creating the Cover Page section

The cover page can be added to any existing template, because the page only appears once and does not affect the rest of your template.

  1. Open your existing template
  2. Expand the Contexts folder in the Resources pane, then the Print folder.
  3. Right-click on the Print folder and select New Section
  4. Select this new section and either right-click and select Rename or just hit F2 on your keyboard
  5. Enter a name for the page, for example CoverPage
  6. Drag the CoverPage to the first position in the folder, before any other section.

Once the cover page is added, feel free to add any elements to it. You can drag fields from your record (assuming they are what you want to show on the cover page). In my case, I added the CoverPage_DocumentCount to the cover page. But, say you have a cover page for each document set, you could easily add an address block, customer information, etc.

Did you know?
If you add a cover page at the Document Set level (in your Workflow, this will be the GROUP metadata level!!!) you could easily use this trick to add a letter for each of your clients that receive more than one document by mail? The address block can appear in your envelope window, easy-peasy!

Step 3: Adding the Control Script

The Control Script will be used, in this case, to only hide the CoverPage section if the Coverpage_Required field is set to false. This is a very simple, 3-line script that goes as follows:

if(!record.fields["CoverPage_Required"]) {
       merge.context.sections['CoverPage'].enabled = false;

To add this script:

  1. In the Scripts pane, click the arrow next to the Add Script button, and select Control Script
  2. Drag the new script to the very top of the list. It has to appear first.
  3. Double-click on the script and change the following elements:
    • Change the Name to something appropriate such as Cover page control
    • Remove all the code present in the example, and paste the above 3-line script.
    • Click Ok to save.

Step 4: Building the Workflow Process

A basic process that does Print Output is composed of 4 tasks:

  • Executed Data Mapping
  • Create Print Contents
  • Create Job
  • Create Output

We’ll need to add some metadata management tasks right before the Create Print Contents task. To add a cover page at the Job level, a single task is required: the Metadata Fields Management task. Within this task, we need to add 2 actions:

  • One that modifies the CoverPage_required field to true on the first document only.
  • One that modifies the CoverPage_requied field to false on all other documents.

Here’s how to add the first one:

  1. In the Metadata Fields Management Properties dialog, click on the (+) sign under the list.
  2. In the Rule dialog that appears, click the Green Checkmark button (*Insert a condition*)
  3. The left part of the condition should be GetMeta(SelectedIndexInJob[0], 11, Job.Group[?].Document[?]), which is equivalent to “The current document index in the job”.
  4. The operator (center part) should be (#) Equal, the numerical equivalence operator
  5. The right part of the condition should be the number 0
  6. Verify that the rule “preview” displays: (GetMeta(SelectedIndexInJob[0], 11, Job.Group[?].Document[?]) (#)Equal 0)
  7. You may enter a rule name such as First Document
  8. Click OK to save

The second rule should be added in the same way, with the only difference that the Operator (4) should be set to (#) Not Equal – and of course the rule name should be Not first document

One last important thing: because we modified the metadata in the process, we need to make sure Connect takes these changes into account. Double-click the Create Print Contents task and add a checkmark to the Update Records from Metadata

And that should do it!

Here are the solution resources in case you had trouble making it work: Connect package and Workflow configuration.

Addendum 1: Cover page at a different level

To add the cover page at a different level, you will need just a tiny bit more work in the Workflow process. Worry not, it’s still fairly simple. However the only other level that is available in the metadata at this point, is the Group level, which is equivalent to the Document Set when generating output.

The task necessary to do this is the Metadata Level Creation task, which will generate the necessary metadata level for us.

  1. Add the Metadata Level Creation task before the Metadata Fields Management task.
  2. In the properties, set the Delimiter at the Group level to Begin when
  3. In the Rule box, set a rule to create a new group/document set. For example, to create a new document set when the customer ID changes, you can use the following condition: (GetMeta(_vger_fld_CustNumber[0], 10, Job.Group[?].Document[?]) Value changed )
  4. In the Metadata Fields Management, don’t forget to change

Have a look this Workflow Configuration to make things clearer.

Is your data not sorted? Not a problem, see below!

Addendum 2: Sorting and Filtering!

We started this how-to by indicating there was a downside to the cover page trick: You can’t order and filter your data using Job Presets. But did you know you could still do this using the Metadata Tools before your records are processed using the Content Creation tasks? That’s right, you’re not that limited! Well maybe a little bit.

Because we checked the Update Records from Metadata option, this means any change we make in the metadata, including filtering and sorting, will be taken into account when generating the content items – records that have been filtered out will not appear in content generation or in the output.

Here are the tasks available to you in the Workflow module!

  • The Metadata Sorter task is used to modify the order of your records. Records are at the Document level, so you can sort by up to 3 parameters on that level!
  • The Metadata Filter task is an inclusive filter system. Any record that does not correspond to the rules set in the task’s properties will not appear in your output.
  • The Metadata Sequencer can be used to output “blocks” of data (similarly to the separation options of the Job Presets). Sequencing is available at the Document Set level (which, again, is equivalent to the Group level in the metadata!) or the Document level.

Leave a Reply

Your email address will not be published. Required fields are marked *