Technical Article: Report Data Source Configuration Files

Report Data Source Configuration files are created in the shipped Template Designer TX Text Control Words and include data connections and created data relations. It is not required to define data relations for Master-Detail blocks in your code. All you need to do is to open a data source in the Template Designer, create the relations and to save these settings as a Report Data Source Configuration file.

Create Data Relation

In the Template Designer, there is a dialog to define the relations between several tables that are used in the designer for the preview of the report. Those settings can be directly saved as the XML based configuration files.

Image

The unique advantage of this approach is the flexibility you gain with separate files that hold the data source information. You can easily use the same configuration file with different templates. Consider a situation when the data source is changed - maybe a new SQL Server. In this case, you don't need to change all your templates, but only one configuration file.

In the Template Designer, you simply save the configuration file and your template.

Image

In Visual Studio, only one line of code is required to merge the template with the given data source and all defined relations. All you need to do is to drag and drop a TextControl and a MailMerge component onto your form in order to:

  • Connect MailMerge with the TextControl instance using the TextComponent property
  • Specify your data source configuration file path
  • Specify your template file path

Image

Finally, in your code, you simply need to call the Merge method of MailMerge to start the merge process.