PDF Merger merge options

Prev Next

There are two ways to tell PDF Merger which files to merge: merge with a configuration, where you list each file, or merge with a query, where PDF Merger merges the files on every record a query or report returns. You choose one in the PDF Merger Parameters formula field. The installation wizard calls them Configuration Setup and Query Setup.

Which option to use

Merge with a configuration

Merge with a query

Use it when

You know exactly which files to merge—for example, a cover page, the record's own document, and a closing page.

You want every file that matches some criteria—for example, the attachments on all the child records of a project.

Files can come from

Any records in any tables, and each file can be in Quickbase, Amazon S3, or Dropbox.

The records of one table. All files come from the same kind of storage.

Number of files

Fixed: one entry per file. The wizard sets up to five; you can add more in the formula.

Changes with the data: one or more files for each record the query returns.

Order of files

The order you list them.

The query's sort order, then the order of the fields on each record.

Main parameter

Configuration

msqry (a query) or msqid (a report)

Use one option per PDF Merger Parameters field. If the field has both Configuration and msqry or msqid, or both msqry and msqid, PDF Merger doesn't merge anything.

Both options also use the same general parameters—clientid, appid, apptoken, errorfid, mrgdte, triggerfid, type, and configid. See Formula Text field parameters.

Note

Type parameter names exactly as shown on this page—they're case-sensitive (for example, S3=Y, not s3=Y). Parameters are separated by spaces, so no value can contain a space.

Merge with a configuration

The Configuration parameter is a list of entries separated by a pipe (|). Each entry points to one file. The last entry is different: it says where to save the merged PDF.

Configuration={file 1}|{file 2}|...|{where to save}

The basic entry is a table, a record, and a file attachment field:

{table dbid}:{Record ID#}-{file attachment field ID}

For example, bq5d6e7f8:12-6 is the file in field 6 of record 12 in table bq5d6e7f8.

Example: an employee welcome package

This formula merges a cover page (record 12 of a Document Templates table, field 6), the employee's own document (field 10 on the record PDF Merger runs from), and a closing page (record 15 of Document Templates), and saves the result to field 25 on the same employee record:

"Configuration=" & [_DBID_DOCUMENT_TEMPLATES] &":12-6|"
  & Dbid() & ":" & [Record ID#] & "-10|"
  & [_DBID_DOCUMENT_TEMPLATES] & ":15-6|"
  & Dbid() & ":" & [Record ID#] & "-25"
& " fn=Welcome_Package"

Use Dbid() and [Record ID#] for the record PDF Merger runs from, and a table alias such as [_DBID_DOCUMENT_TEMPLATES] for other tables. fn is the merged file's name, without spaces.

Files from Amazon S3 or Dropbox

An entry can point to a file in Amazon S3 or Dropbox instead. The field ID is then a field on the record that stores the file's S3 key or Dropbox file name. You can mix Quickbase, S3, and Dropbox entries in the same configuration.

Where the file is

Entry

Example

Quickbase file attachment field

{dbid}:{Record ID#}-{field ID}

bq5d6e7f8:12-6

Amazon S3, your account's bucket

{dbid}:{Record ID#}-s3:{S3 key field ID}

bq5d6e7f8:12-s3:15

Amazon S3, another bucket

{dbid}:{Record ID#}-s3:{bucket}:{S3 key field ID}

bq5d6e7f8:12-s3:contracts_bucket:15

Dropbox, your account's folder

{dbid}:{Record ID#}-DB:{file name field ID}

bq5d6e7f8:12-DB:16

Dropbox, another folder

{dbid}:{Record ID#}-DB:{folder}:{file name field ID}

bq5d6e7f8:12-DB:contracts:16

Where the merged PDF is saved

The last entry in the configuration says where to save the merged PDF:

Save to

Last entry

What happens

A file attachment field

{dbid}:{Record ID#}-{field ID}

The merged PDF is saved to that field. The record must already exist; it can be in another table.

Amazon S3

{dbid}:{Record ID#}-s3:{field ID} or {dbid}:{Record ID#}-s3:{bucket}:{field ID}

The merged PDF is saved in your account's bucket, or the bucket you name, with a new key: the file name, table, record, and five random characters (for example, Welcome_Package_bq1a2b3c9_25_K7Q2M). The key is written to the field, which should be a text field.

Amazon S3 with your own key

{dbid}:{Record ID#}-s3:{bucket}:{key}:{field ID}

The same, but the third part is the key itself (not a field ID), so you can build it in the formula. The key is written to the field.

Dropbox

{dbid}:{Record ID#}-DB:{folder}:{field ID}

The merged PDF is saved in that Dropbox folder as {fn}.pdf, and that file name is written to the field. Use a different fn for each record, or files with the same name are replaced.

Good to know

  • If a source field is empty, PDF Merger skips that file and merges the rest.

  • Bucket and folder names in the configuration can't contain a hyphen (-), because the hyphen separates the record from the field.

  • To merge more than the five files the wizard sets up, add more entries before the last one.

Merge with a query

With a query, PDF Merger finds the records in one table, then merges the files on each of them. You give the table, the query or report, the fields that hold the files, and where to save the result.

Parameter

Description

Sample

dbid

The table to take the files from.

dbid=bq9h8g7f6

msqry

A Quickbase query that picks the records. Use either msqry or msqid.

msqry={'6'.EX.'25'}

msqid

The ID of a report on the dbid table. PDF Merger merges every file attachment field in the report's columns, so clist isn't needed.

msqid=5

clist

With msqry: 3, then the IDs of the file attachment fields to merge, separated by periods. Always start with 3—PDF Merger skips the first ID in the list.

clist=3.8.9

slist

The field to sort the records by. Defaults to Record ID# (3).

slist=7

mrgdbid

The table to save the merged PDF in.

mrgdbid=bq1a2b3c9

mrgrid

The Record ID# of the record to save it on. The record must already exist.

mrgrid=25

mrgfa

The file attachment field to save it in.

mrgfa=10

mrgfn

The merged file's name, without spaces. Required for a query merge.

mrgfn=Project_Timesheets

Example: every job's timesheet on a project

This formula, on a Projects table, merges the Job Timesheet file (field 8) of every Jobs record whose Related Project (field 6) is this project, sorted by Record ID#, and saves the result to field 10 on the project:

"msqry={'6'.EX.'" & [Record ID#] & "'}"
& " clist=3.8"
& " slist=3"
& " dbid=" & [_DBID_JOBS]
&" mrgdbid=" & Dbid()
&" mrgrid=" & [Record ID#]
&" mrgfa=10"
& " mrgfn=Project_Timesheets"

The query can't contain spaces either, so match on IDs or values without spaces—for example, a Record ID# or a status code.

Files in Amazon S3 or Dropbox

If the records store S3 keys or Dropbox file names instead of attachments, add these parameters. PDF Merger then reads those fields instead of file attachment fields.

Parameter

Description

Sample

s3fid

The field that stores each file's S3 key.

s3fid=12

s3bktfid

Optional. A field that stores each file's bucket, if the files are in different buckets.

s3bktfid=13

s3bkt

Optional. The bucket to use instead of your account's bucket.

s3bkt=contracts_bucket

dbfid

The field that stores each file's Dropbox file name.

dbfid=14

dbfolderfid

The field that stores each file's Dropbox folder. Required with dbfid.

dbfolderfid=15

Saving the merged PDF to Amazon S3 or Dropbox

  • Amazon S3: add S3=Y. PDF Merger saves the merged PDF with a new key (or the key in cstmkey), in your account's bucket or the one in s3bkt, and writes the key to the mrgfa field—use a text field for it.

  • Dropbox: add DB=Y and dbfolder={folder}. PDF Merger saves the merged PDF as {mrgfn}.pdf and writes that name to the mrgfa field.

Good to know

  • If the query returns no records, PDF Merger writes There are no records retrived for the query to the error field.

  • Records with an empty file field are skipped.

Limits

Your account has a maximum number of files per merge and a maximum size for the merged PDF. If a merge goes over either one, PDF Merger stops and writes the reason to the error field.

Learn more