Generating Report Definition Language Programmatically
Report Definition Language (RDL) is a set of instructions that describe layout and query information for a report. RDL is composed of Extensible Markup Language (XML) elements that conform to an XML grammar created for Reporting Services. RDL describes the XML elements, which encompass all possible variations that a report can assume.
RDL promotes the interoperability of commercial reporting products by defining a common schema that enables the interchange of report definitions as a standard way of communicating using reports.
RDL is not a programmatic interface or protocol like HTTP or ODBC. It does not specify how report definitions are passed between applications or how reports are processed. Because RDL is fully encapsulated, you can write code that interprets an RDL document without having to know anything about the source application. Any protocol or programmatic interface that works with XML can be used with RDL. RDL is:
- An XML schema for report definitions.
- An interchange format for businesses and third parties.
- An extensible and open schema that supports additional namespaces and custom elements.
There are two primary agents that interact with RDL: consumers and producers. Consumers are applications that can interpret RDL and generate reports that can be viewed by end users. Consumers must be able to read RDL, retrieve data, and produce a report output format that can be displayed in a human or machine-readable report. An example of a consumer of RDL is the report server.
Producers, on the other hand, are applications that can generate RDL based on input from tools that enable users to design and create reports. One example of a producer of RDL is Report Designer.
Because of the open and extensible nature of RDL, a variety of tools and applications can be built that generate RDL based on its XML schema. One of the easiest ways to generate RDL from an application is to use the Microsoft .NET Framework classes of the System.Xml namespace. One class in particular, the XmlTextWriter class, can be used to write RDL according to the specification and compliance level agreed upon by the consumer and producer. With XmlTextWriter, you can generate a complete report definition from start to finish in any Microsoft .NET application. For more on the XmlTextWriter class and the System.Xml namespace, see the Microsoft .NET Framework Developer's Guide.
For an example of how to build a simple application that generates RDL, see Walkthrough – Generating RDL Using the .NET Framework.