Technical Article: Prefixed Merge Fields

The easy creation of pixel-perfect reports using a flow type layout design is the core concept of Text Control Reporting. But at the same time, this word processing concept is combined with the power of reporting tools. Creating nested repeating blocks with Master-Detail relationships is the strength of the MailMerge component.

Prefixed merge fields

Data relations and data source connection strings can be defined in TX Text Control Words - the customizable template designer. Those settings can be exported to Report Data Source Configuration Files and directly loaded into the used MailMerge instance.

The data relation can be prefixed onto the field name. Consider the following data source structure of our sample database that somes with TX Text Control Words:

In this sample, an invoice for an order should be created. The master table is Sales_SalesOrderHeader which contains general information about the order and relations to sub-tables. It is connected to Sales_SalesOrderDetail through the SalesOrderID. These order details consist of sold products defined in another table named Production_Product.

During the merge process, you simply need to specify the master table and TX Text Control's Reporting engine is getting the related tables automatically. The following screenshot shows the repeating block Sales_SalesOrderDetail with merge fields from sub-tables:

The fields OrderQty, UnitPrice and LineTotal are coming directly from the table Sales_SalesOrderDetail. They don't have a prefix as the surrounded block is filled from Sales_SalesOrderDetail.

The fields Production_Product.ProductNumber and Production_Product.Name are coming from a sub-table which is defined by the prefix Production_Product.

Even the image placeholder is named with a prefix sub-table: Production_Product.Production_ProductProductPhoto.Production_ProductPhoto.ThumbNailPhoto.

In TX Text Control Words, a dialog is available that enables the easy creation of such nested fields.

The dialog displays possible relations in form of a tree view to help with the navigation through possible field names.

The following screenshot shows the merged invoice including image fields, repeating blocks prefixed nested merge fields.