By default, Exact Forms Plus saves each document to a file attachment field on the record it was created from. Instead, you can save documents to a repository table: a separate table, related to that table, whose records each hold one document.
A repository table is useful when:
a record has more than one document, for example a quote, an invoice, and a contract for the same project;
you want to keep every version of a document, not only the latest one;
you want one place for documents from several tables, and an embedded report of them on each record.
How it works
Each time the button runs, Exact Forms Plus:
creates the document;
adds a record to the repository table (or updates one, see New or update), and links it to the record the document was created from;
saves the document in the repository record's file attachment field, and optionally copies values from the original record to it.
The original record isn't changed. Its EFP Document and EFP Date fields aren't updated, and the button's other update parameters (faid, efpdte, upmap, uid, clear, docsize) are ignored. To record details such as the date, copy them to the repository record instead (see Copy values to the repository record).
Set it up with the installation wizard
On the wizard's Exact Forms Plus setup step, select Use a Repository Table under Advanced Settings. The wizard then adds the Repository Table Setup step, where you choose or create the repository table and its file attachment field, and choose New or Update (see New or update). For every option on that step and what the wizard creates, see Repository table step. For the whole setup, see Set up Exact Forms Plus with the installation wizard.
The wizard adds the repository parameters to the buttons and to Batch Processing Arguments. To change them later, edit the button as described below.
Set it up in the button
To add a repository table to an existing button, or to change it, add these parameters to the button's formula:
Parameter | What it does | Example |
|---|---|---|
|
|
|
| The repository table. Use its table alias. Required. |
|
| The repository table's reference field to your table, for example Related Project. |
|
| The value to put in |
|
| The repository table's file attachment field for the document. |
|
|
|
|
| With |
|
| Copy values to the repository record. See Copy values. |
|
| Set a user, email, or text field on the repository record to the person who selected the button. |
|
For example, inside the button's Base64Encode():
& "&repository=y"
& "&rpdbid=" & [_DBID_DOCUMENTS]
&"&rpfid=6"
& "&rpfafid=7"
& "&rpmode=a"All parameters are described in Formula URL parameters.
New or update
Mode | What happens |
|---|---|
New ( | Adds a repository record every time. Earlier documents stay as they are, so you keep a full history. |
Update ( | Looks for repository records related to the original record (and, with |
Use Update when each record should have only one document of a kind, for example one current quote. To keep one record per document type, give the repository table a Document type field, set it with rpmap, and match on it with rpkfid and rpkval.
Copy values to the repository record
Use rpmap to copy values from the original record to the repository record: repository field:original field, with | between pairs. For example, rpmap=8:10|9:14 copies field 10 to repository field 8, and field 14 to repository field 9. Exact Forms Plus reads the original fields itself, so they don't have to be in the template's clist.
Don't map the fields in
rpfid,rpfafid, orrpkfid.To record when the document was created, use the repository table's Date Created field.
To record who created it, use
rpuid. Exact Forms Plus runs as the user token saved for your account, so Record Owner and Last Modified By show that user, not the person who selected the button.
Save to Amazon S3 too
You can save each document to Amazon S3 and keep its S3 key on the repository record. Your account must be set up for Amazon S3 first.
With the installation wizard: choose Amazon S3 under Select a Cloud Storage Type as well as Use a Repository Table. The wizard then puts the S3 key and download fields on the repository table instead of your table. See What the wizard creates.
In the button: add amazons3=y and keyfid, the ID of a text field on the repository table:
& "&amazons3=y"
& "&keyfid=12"On each run, Exact Forms Plus uploads the document to S3 and writes its key to keyfid on the repository record. The document is also saved in the repository record's file attachment field (rpfafid).
Make the S3 key different for each run. By default the key is the file name, the Record ID#, and the repository table's ID, for example Quote_12_bxxxxxxxx.pdf. That's the same every time the button runs for a record. With New, each run then replaces the previous file in S3, and all of the record's repository records point to the newest file. To keep every version in S3, set s3keyval to something that changes on every run, for example:
& "&s3keyval=Quote_" & [Record ID#] & "_" & ToText(ToTimestamp(Today(), ToTimeOfDay(Now())))Or include the date and time in fn. See Formula URL parameters for s3keyval and s3bkt.
Dropbox and Egnyte work differently: the document is saved to Dropbox or Egnyte, but its file name or ID isn't written to the repository record. If you need a link to the cloud file on the record, use Amazon S3, or keep the file in Quickbase.
Things to know
Permissions. The user token saved for your account must be allowed to add and edit records in the repository table.
Merged documents (
mrgdbid,mrgrid,mrgfa) are still saved to the record you name in those parameters, not to the repository table.Mailing labels don't support repository tables. With
repository=y, the labels aren't saved anywhere.Values in the update search. If
rpkvalor the key value contains an apostrophe ('), the search can fail. Use values without apostrophes.
If something goes wrong
What you see | What to check |
|---|---|
Exact Forms Plus Error: Input Parameters are Invalid. with repository and rpdbid listed |
|
A repository record is added, but it isn't linked to the original record |
|
A record is updated when you expected a new one, or the other way round | Check |
The repository record has no file |
|
The S3 key isn't on the repository record |
|
Older repository records open the newest document from S3 | The S3 key is the same on every run. Make it unique with |
An error mentioning permissions or the user token | The token can't add or edit records in the repository table. See Troubleshooting. |
The wizard shows a message on the Repository Table Setup step |