Sub-Table Template Files

In a database, information about a single subject can be divided between multiple tables. This allows data to be stored more efficiently.

To extract data from multiple tables, you can configure sub-tables by setting the SubTables parameter. When you extract data from sub-tables, you need to create a template for the main table and a template for each sub-table.

In the main template file, specify the locations where the data from the sub-tables is included in the document. To do this, insert HTML comments (<!--comment-->) where comment is the name of a sub-table defined in the configuration file.

For example, if you set SubTables=Customer the main template might look like this:

#DREREFERENCE <!--OrderID-->
#DREFIELD Date="<!--Date-->"
#DREFIELD CustomerID="<!--CustomerID-->"
#DREFIELD Status="<!--Status-->"
<!--Customer-->
#DRECONTENT
Order information
Date Received: <!--Date-->
Status: <!--Status-->
#DREENDDOC

The sub-table template (referenced by <!--Customer-->) might look like this:

#DREFIELD Customer_Title="<!--Title-->"
#DREFIELD Customer_Name="<!--FirstName--> <!--LastName-->"

Each HTML comment in the sub-table template specifies that data should be inserted from a column in the sub table.

When the connector runs a fetch task, the templates are combined and used to create a single document for each row returned by the query. A resulting document might look like this:

#DREREFERENCE 012345
#DREFIELD OrderDate="16/10/2012 15:27:11"
#DREFIELD Customer="2563"
#DREFIELD Status="Order complete"
#DREFIELD Customer_Title="Mr."
#DREFIELD Customer_Name="John Smith"
#DRECONTENT
Order information
Date Received: 16/10/2012 15:27:11
Status: Order complete
#DREENDDOC