Creating Merge Fields

compared with
Current by Kevin Kempf [SoftArtisans]
on Aug 10, 2010 09:57.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (8)

View Page History
* Data source and column names may include the following characters only:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_ {note}If you [assigned a different data source separator|WordTemplate.DataSourceSeparator], you can also use a "." in your data source and column names.{note}
* Spaces are not allowed anywhere in a merge field except within a column name in brackets (for example, «Products.\[Product Category\]» . To include spaces in the data source column name, use this format:«DataSource.\[Column Name\]»
For example: «Employees.\[Street Address\]» . The \[Column Name\] format allows you to match any SQL column name exactly. Legal characters within the brackets include every character except parentheses () or brackets \[\].
* Spaces are not allowed anywhere in a merge field.

{info}*Use brackets if your column name does not conform to these rules*
The exception of these rules is when a column name is enclosed in brackets (for example, «Products.\[Product Category\]» . To include spaces or unicode characters in the data source column name, use this format:«DataSource.\[Column Name\]»
For example: «Employees.\[Street Address\]» . The \[Column Name\] format allows you to match any SQL column name exactly. Legal characters within the brackets include every character except parentheses () or brackets \[\].{info}


h2. Using Short Merge Fields {anchor:short}

WordWriter supports several full-length and short merge field forms. When you use any of the long merge field formats, you explicitly include both the data source name or number and the column name or number. Short formats do not specify both data source and column explicitly; one or the other is omitted. How WordWriter understands a short merge field depends on whether or not the marker contains a $.

WordWriter understands «$Employee» as the first column of the data source "Employee." If you omit the $, WordWriter will read "Employee" as a column from the first data source defined in the WordWriter code.

* «$Employee» means the first column in the data source "Employee." \\ \\
* «Employee» means the "Employee" column in the first data source defined in the WordWriter code.

h3. Examples
|| «$DataSourceName» | «$Orders» First column in the data source "Orders." ||

{note}If you are using the [WordTemplate.SetMailMerge] method, you *must* use Short Merge fields.{note}

h2. Using Long Merge Fields {anchor:long}