The article provides information how to specify which report to be processed, and on the available option based on the report format (Visual Studio report or XML content).
Reports can be stored in different locations and in different formats so there should be a uniform way to access them. This is achieved through the various report sources that the Reporting engine provides.
The report sources are utilized by:
- The report viewers when specifying the source for a report to view. For more details check How to: Set ReportSource for Report Viewers.
- The SubReport item.
- For any report item that would use drill-through action (NavigateToReport action).
When you render or print reports programmatically, through the
- RenderReport - for exporting reports programmatically on the server-machine;
- PrintReport - for printing reports from the server machine.
For more details, check Set ReportSource for ReportProcessor.
UriReportSourceThe URI report source allows you to load a report document, usually produced by the Standalone Report Designer or the Web Report Designer from a physical TRDP, TRDX or TRBP file. The absolute or relative path to the physical file should be indicated in the
Uriproperty. An example is illustrated in the API Reference: UriReportSource.
TypeReportSourceThe reports created with Visual Studio Report Designer are usually stored as.NET classes inheriting Telerik.Reporting.Report|ReportBook. To access a.NET class declaratively you can use the assembly qualified name of the report's type. The Reporting engine will use Reflection to create an instance of the report class by using its default parameterless constructor. An example is illustrated in the API Reference: TypeReportSource.
InstanceReportSourceThis report source is used when you have a reference to an already instantiated report (Telerik.Reporting.Report instance), and you want to pass it to the reporting engine. Typical scenarios include reports created or modified in code, dynamically generated ReportBook objects or report instances result of deserializing or unpackaging content produced by the Standalone Report Designer. An example is illustrated in the API Reference: InstanceReportSource.
For reports created in Visual Studio Report Designer without further modifications in code, we recommend the usage of the TypeReportSource.
XmlReportSourceThe XML report source can be used if the report is serialized in XML and stored in a string.The primary intent for this report source is to be used with database fields where the report is stored as pure XML. In order to access it set the Xml property of the report source to the field that contains the report xml. For example: xmlReportSource.Xml = "=Fields.ReportXml". An example is illustrated in the API Reference: XmlReportSource.
The created report source inherits
Report parameters values can be passed from the report source object. Each report source has a Parameters collection which determines the parameter values that are passed to the report when it is initialized. Please, note that the name of the parameter should match the names of the Report Parameters as the report source's Parameters collection is mapped by key to the report's ReportParameters collection.
The Report Source is not aware of the currently displayed report and its ReportParameters collection. To send a value from the report source object, you need to know the report parameter's key (Name).