Include related data with subtables

Prev Next

PDF Stamper

Related table data, or detail data, can be displayed for the master record that the document is being generated for. In other words, if you have a Customer table with a relationship to an Order Details table, you can display the related Order Detail records when creating an Invoice document.

For example, the table-to-table relationships list for the Customers table includes the relationship Customers → Order Details, described as Each Customer has many Details. This makes the Customers table the "master" table and the Order Details table the "detail" table.

The detail data appears in tabular format in the generated document. For example, an invoice generated for a customer shows a table with the columns Item, Price, Quantity, and Subtotal, with one row per Order Details record.

Document Subtables

On the Document Subtables table in your Quickbase app, the field named Settings controls the formatting of the subtable that appears in the generated document.

In the PDF Subtables section of a Document Subtable record, the settings field holds the parameter string, and the Template Reference field shows the marker you place in the PDF template for that subtable. For example:

  • settings: ~dbid=bnkxkhz2n,qry={'11'.EX.[Record ID#]},slist=3,clist=9.13.6.14~

  • Template Reference: ~strid=85~

You need to manually add or edit the settings field, so be careful when you do—one wrong character can cause issues, and it's best to start over if that happens. Keep the parameters in this order: dbid, qry, slist, clist.

The best way to use this is to add this string into your template: ~strid=85~ needs to be added to the first cell (first column, first row), and ~strid=85end~ needs to be added to the last cell (last column, last row) of the table in the PDF template.

You'll also need one blue form field for each data point you want. For example, to show four fields from a record, use four blue form fields in a row, repeated for each row in the template.

Important

You can't add more subtable records than the number of table rows on the PDF template. For example, if a template has six table rows, so it can show up to six subtable records.

Parameter

Description

Sample Value

Required

dbid

Table ID—for the related table

dbid=bnkxkhz2n

Yes

qry

Query—specifies the filtering criteria for retrieving the records from the related table.

Learn how to format a query.

qry={'6'.EX.[Record ID#]}AND{'10'.EX.'Active'}

Yes

clist

Column list—defines which columns should appear in the table. The prefix characters are required and tell the script how to format the data.

clist=9.13.6.14

Yes

slist

Sort Order—this determines how the data that appears in the subtable is sorted

slist=7.8.9—primary sort is field 7, then 8, then 9—default is ascending

slist=3

Yes

Example:

The following is an example of a parameter string used within an Order template. It retrieves the related Order Details records for the Customer record and formats the data in a PDF template table in the output document.

Settings field sample:

~dbid=bnkxkhz2n,qry={'11'.EX.[Record ID#]},slist=3,clist=9.13.6.14~