If your template is mapped with a related table that has a one-to-many relationship with the main data source, you can specify which of the related records you want to use to render values in the generated PDF document. 

For example, you might need to generate an order summary in which you fill in the same parameters (for example, product name, number of items, and price) for different items purchased, with each item in a separate line. In this case, in line 1 of the “Items purchased” section of your document template, for each item parameter field, you configure the field to render the value from the first record returned from the related table; for line 2, you set all the fields to use values for the second record, and so on. You do it by entering the sequential record number in the Record index field.

Prerequisites: In a template, in the Data source field, select a table that has a one-to-many relationship with at least one other table, and then choose the related tables that you want to use, in the Related tables panel. For more information, see Mapping templates.

As a best practice, set field sorting to make sure which records from related tables are listed first to make sure the PDF document contains the correct values. For example, for an order summary document, you can sort the fields by the Product Name” field. 

Steps to map a template field with related table fields: 

  1. Select the Click to map link for any field on the right panel or click any field in the PDF file preview to map the PDF field elements.  
  2. From the Mapping type dropdown, select Data source field.  
  3. From the Data source field dropdown, select a related table field to be mapped with a PDF field.

    Note: You cannot map the Password data type fields.

  4. In the Record index field, enter the sequential number for the record that you want to use from the related table.
    Note: If you enter a value that is higher than the number of returned records, the PDF document field will be empty.
    The field editing panel showing settings for selecting the exact record to be used from the data source.
  5. For Checkbox fields, select the condition on which the checkbox is selected on the generated PDF with the Checkbox selected if value option.
  6. Click Next field to map another field or Save to confirm your changes to the template.