« Return to TrackVia.com
TrackVia

Document Merge

Tool

Document merge

Description

You can generate a Word document that merges values from database fields into the document. For example, you can create a "Thank you for your order" form letter and then merge database records into this template to quickly and easily create documents that you can print and mail to new customers.

TrackVia's Document Merge feature can be used to print one record or a set of records (any view) with a template that you create using Microsoft Word or a similar word processor. For example, your template could be a form letter or an invoice. When you merge a record into a template, the field values from the record are substituted into placeholders in the template.

Here's a 10-minute video that provides an in-depth example of Document Merge in action!

Notes

Create a template

To use document merge you must first create a template and store it in TrackVia. To create a template:

  • Create a new document in Microsoft Word or a similar word processor. Enter the text, logos, formatting, and other content you want to appear in your template.
  • Insert placeholders in your template document everywhere you want a record field to be substituted in. The placeholders are your TrackVia table field names with a tilde (~) at the beginning and end of the word.
    Examples:
    Field Name   Placeholder
    First Name   ~first name~
    Email   ~email~
    Street Address   ~street address~
    Invoice #   ~invoice #~
    Dept. code   ~dept. code~
  • Save your template as an .rtf file (Rich Text Format). In Microsoft Word, use the File > Save As command, and in the Save as type drop-down box, select Rich Text Format (*.rtf).
  • Upload your template into TrackVia, using the Documents tool. You'll find this link in the Tools section left of the Table Overview Page for your table.

Generate merged documents

How to create a 

document merge template

1.  Insert placeholders to indicate where you'd like data to be merged from TrackVia into a Word document.

2.  Choose to "Save As" and select file type Rich Text Format.

3.  Go to the Document merge link under Tools.

4.  Go to the Templates tab.

5.  Click on the Choose File button.

6.  Find your template file and then hit the "Open" button.

7.  Click the "Add template" button.

 

By default TrackVia will create one document for each record in the view.  The merged document should open up in your word processor. If it doesn't, save the merged document to your hard drive, and then open it with your word processor. To print the document, use the Print function in your word processor. Please note that there is a 75-megabyte limit on the size of the merged document.

Placeholder Tips

TrackVia may have trouble recognizing your placeholders. The following tips will increase your chances for success:

  • Do not change formatting within a placeholder. If you want the substituted text to appear in bold, a certain font, or a certain color, you may apply that formatting to the entire placeholder. But do not use different formatting for different letters of the placeholder.
  • The capitalization of placeholders does not have to match the field names – you can use uppercase or lowercase letters in your placeholders.
  • Putting your placeholders into tables can help control the layout. When record values are substituted into the template, the values may be longer or shorter than the placeholder, pushing other text on your page left or right. Tables can help control the wrapping that your word processor uses to lay out text on the page.

Built-in placeholders

TrackVia provides some built-in placeholders for data that TrackVia automatically captures:

Placeholder   Value
~record locator~   TrackVia record locator number
~created by~   person who created the record
~created date~   date and time the record was created
~updated date~   date and time the record was last modified
~me~   full name of the person performing the merge
~now~   date and time the merge was performed
~today~   date (without time) the merge was performed
~next record~   advances to the next record in the view without starting a new page
~first record~   used to loop through records in a view a second time
~last record~   used to stop another loop, remove blank page at the end

Multiple records per page

That last placeholder, ~next record~, causes TrackVia to advance to the next record in the view without starting a new page. You can use this to display several records on the same page.

For example, suppose you're printing a membership directory. You might create a single-page template that looks like this:

~full name~
~address~
~phone number~
~email address~
~next record~

~full name~
~address~
~phone number~
~email address~
~next record~

~full name~
~address~
~phone number~
~email address~

The template uses the ~next record~ placeholder after the first and second copy of the data paragraph. This won't result in any printed output, but will cause TrackVia to advance to the next record. We don't use ~next record~ after the third paragraph, because TrackVia will automatically advance to the next record in the view when it reaches the end of the template and starts again at the top of a new page. If you merge this template with a large set of members, the result will be a multi-page output document that has three members per page.

Formatting Options

When merging a view, TrackVia will use the view's field formatting options. For example, this can be used to remove the time component of a date/time field, limit a long paragraph field to a certain number of characters, or show all numbers with two decimal places. Field display options are not available when merging a single record; instead, create a view with a filter that includes just one Record Locator number, and then merge the view.

Some word processor features, like Tables of Contents, Footnotes, change tracking, etc., may not work in TrackVia's 

document merge. Test your document, and simplify any features that cause problems.

Blank values

Be aware that if a record has a blank value in a field (one that shows up as up as (none) in TrackVia), TrackVia will put a blank in the merged document. This can cause errors in your documents, such as a form letter that starts out with Dear Mr. , with no name. Check your merged documents for missing fields, or use the sort arrows in your view to check each column for blank values before doing the merge (the (none) values will appear at the top if you sort in ascending order).

Merging from linked tables

Using Document Merge you can also include any fields from a table direclty linked to from the table where you're doing the merge.  To include these fields use the field name as you'd see them appear at the end of the fields list when building a view.  These will have the name of the linked field in square brackets and then the name of the field from the other table. For Example: If you have a table of Contacts linked to a Company table by the Company Name field you could merge a record in the Contacts template and include the Company Website field from the Company table.  The placeholder for this would appear as ~[Company Name] Company Website~.