Back to all How-tos

Add a Record Index and Count to your document

While Designer has integrated methods of displaying page numbers, sometimes you want to know a little more. In this short How-To we’ll show you how to get the current record index, and the total number of records in the record set, displayed on your document.

Step 1 - Getting the Record Count

The Record count is part of the Metadata generated by the Execute Data Mapping task in Workflow. In order to get it into designer, you’ll have to create an empty field called RecordCount in your data mapping configuration, and complement it from workflow

Specifically, the data you want is located in the metadata under JobGroup, in the Product Information section at the top. The specific field is Number of Documents in Group.

Setting this value to a Metadata field as per the complement how-to makes it available in Designer.

Step 2 - Getting the Record Index

The Record Index is something you can grab from the Data Mapping Configuration, in a very straightforward manner. To do this:

  1. Create a new field called RecordIndex
  2. In an existing Extract step, add a new JavaScript extract field
  3. Enter record.index in the JavaScript box.

Step 3 - Putting it all together in Designer

Since you now have 2 fields in your data model, adding this anywhere in Designer is fairly straightforward. Here’s an example where a span or div called recordData contains Record: x of n when the job is processed through Workflow:

Tags
workflow

Leave a Reply

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