Introduction
Microsoft SQL Server 2005 Reporting Services provides a server-based platform for creating and viewing reports. It also has several default controls which can be used to enhance the report output. Various APIs are also provided through which it is possible to create, manage and deploy the reports easily. One of the un-explored features of the reporting services is its support for creating a custom control which can be used in the report. This custom control is termed as Custom Report Item (CRI). Microsoft has included the details of the Custom Report Item in the May-2007 release of Books Online.
In its first release, it is only possible to create/render the CRI as an image. This means that the CRI created will be generated as an image when the report is rendered. The interactive CRI is not possible.
How a Report executes?
The reports which are created using Reporting Services can be viewed at two stages:
- Design time
- Run time (rendered)
At design time, you can drag-n-drop controls which are required and write expressions for displaying the data. When the report is preview or executed:
- Parameters are loaded for selection.
- Datasets associated with the report are filled with data based on the parameter selection.
- Expressions are calculated and values are assigned to the specified control.
- Report is rendered and displayed in the browser.
What is Custom Report Item?
Custom Report Item allows:
- Extension to the functionality of the existing controls.
- Creation of new custom controls to display the data as required.
- Creating chart object, that can access and plot the data based on custom logic.
It is an element, which gets added to the RDL file when it is used in any report. Remember that the RDL file is an XML file which is used to specify the definition of the report.
Any control which is created has two components: Design time and Runtime components.
The design time component is available when the control is used at the time of designing the look and feel of control. The runtime component is when the control is executed and renders itself based on the properties specified.
As the custom report item is an extension to the existing RDL files, the existing reporting services configuration files need to be modified. Without these changes, the custom report item will not be available in the visual studio designer and at the runtime. I will discuss the configuration changes required for deploying the CRI in the next part.
Basic process for CRI execution in Reporting Services Engine
- Reporting services engine has 2 models, report processing and repot rendering model.
- The processing model loads the Report definition (RDL) file from the report server. It then connects to the data source which is specified in the report definition and loads the data.
- This data is then passed to the Rendering model, which evaluates the various logic specified (expressions, conditions, etc) in the report definition and renders the output as an image.
- The CRI is generated and rendered by the rendering model based on the logic specified in the control.
- This rendered image is then displayed on the report.
Conclusion
Forget the 3rd party controls for custom graphics and charts. Hire someone to create a custom report item and create your own controls based on the requirements. This text is having a basic introduction of CRI. The second part will have the detailed description for the creation of design-time and runtime components for the CRI. A sample CRI will also be included.