Blog Series: Flow Type Layout Reporting

A master-detail relationship is a 1:n (one-to-many) type relationship. A typical example for such a relationship is a purchase order and a set of items that belongs to each purchase order. This allows you to create complex nested reports in a very easy way.

TX Text Control's repeating blocks can be nested in unlimited levels. Those nested blocks can be inserted in the same way like usual merge blocks.

Each block has an unique name which should match the name of a DataTable in the merge data. If nested blocks with an existing DataRelation are recognized, they are combined automatically. The following screenshot shows the concept of nested blocks and the data relations:

Master-detail relationship blocks

The range from the green start bookmark to the green end bookmark is the outer block representing article groups. The inner block is marked with blue markers.

Marker colors are for visualization purposes only. In TX Text Control, all markers are gray.

Looking at the merged results show that the articles are mapped automatically:

Master-detail relationship blocks

The Merge Data Structure

The block data consists of two tables with an unique relationship (article_group_id):

Master-detail relationship blocks

Inserting the Nested Blocks

  1. In TX Text Control Words, insert a table as shown below with a merge field in a cell from the outer data table.

    Master-detail relationship blocks

  2. Select the table and 2 blank lines under the table and choose Insert Merge Block from the Merge Block ribbon group.

    Master-detail relationship blocks

    In the opened dialog box, type in the name of the outer DataTable and confirm with OK.

    Master-detail relationship blocks

  3. Insert another table below the existing table and add fields from the inner data table. Select the whole table row in order to insert another block called Article.

    Master-detail relationship blocks

The following code shows how to build the data, the data relationships and how to merge these blocks using TX Text Control's Reporting classes:

DataSet dsBlockData = new DataSet();

// article group
DataTable dtGroup = new DataTable("Group");

dtGroup.Rows.Add(new object[] { 1, "Vegetables" });
dtGroup.Rows.Add(new object[] { 2, "Fruits" });

// article
DataTable dtArticle = new DataTable("Article");

dtArticle.Rows.Add(new object[] { 1, "Asparagus",
    "Asparagus officinalis is a spring vegetable.", "110" });
dtArticle.Rows.Add(new object[] { 1, "Potato",
    "The potato is a starchy crop of the Solanaceae family.", "220" });
dtArticle.Rows.Add(new object[] { 1, "Carrot",
    "The carrot is a root vegetable, usually orange in colour.", "330" });
dtArticle.Rows.Add(new object[] { 2, "Apple",
    "The apple is the pomaceous fruit of the apple tree.", "440" });
dtArticle.Rows.Add(new object[] { 2, "Strawberry",
    "The strawberry is a hybrid species.", "550" });


DataRelation drGroupArticle = new DataRelation("GroupArticle",


mailMerge1.Merge(null, true);