Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.7.1
SQL Server 2005

View Docs for Another
Version or Platform

How to Create Word Reports > Adding Merge Fields

Adding Merge Fields

An OfficeWriter Word template is a Word file that contains merge fields. A merge field is a placeholder for database values. When the report is published, OfficeWriter will replace the merge fields with data from the database. The format of a merge field is:

<<DatabaseQueryName.FieldName>>

For example, this merge field is a placeholder for values from the "Last Name" field in the data set returned by a query called "Employees":

<<Employees.LastName>>

The template shown below contains three merge fields.

A query's range may be either Document or Selection. If a query is set to Document range, only the first row of data is returned from the query. If a query is bound to a Selection within the document - a text fragment, list, or table row - the query will return all the rows to the report and the selected text will be repeated for each row returned from the database.

Adding Selection Merge Fields

  1. Place your cursor at the point in the document where you want to insert the merge field.

  2. On the OfficeWriter toolbar, click Insert Merge Field and select a field.

  3. Repeat steps 1 and 2 to insert additional merge fields.

  4. Highlight the set of merge fields that you want to repeat for each row of data returned by the query.

  5. Select Query Range from the OfficeWriter toolbar.

  6. Make sure that Selection is chosen and click Ok.

Adding Document Merge Fields

  1. From the OfficeWriter Designer's Select Query drop-down, select a query.

  2. Click Query Range.

  3. In the dialog, select Document. Click Ok.

  4. Place your cursor at the point in the document where you want to insert the merge field.

  5. On the OfficeWriter toolbar, click Insert Merge Field and select a field.

  6. Repeat steps 1 and 2 to insert additional merge fields.



Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.