The ReportGallery class maintains a list of registered reports and creates a ReportQuery based on a given report code. When a ReportQuery is created, it is also cached by the ReportGallery and can be retrieved by calling GetReportQuery and providing the queryId.
Example
This example shows how to create a ReportQuery, generate the report and return a PDF.
var query = ReportGallery.NewReportQuery(“InvoiceReport”);
var builder = new ReportBuilder();
var document = builder.BuildReport(query);
var pdfStream = document.ToPdf();
return new FileStreamResult(pdfStream, “application/pdf”);
Properties
CacheMinutes | The number of minutes to cache report queries. The default is 20 minutes. |
SaveToCache | A delegate that may be used to cache ReportQuery instances in a cache. By default, ReportQuery instances are stored in a static memory cache for 20 minutes. |
LoadFromCache | If SaveToCache is used to implement an alternative caching method, then LoadFromCache must also be implemented to load ReportQuery instances from the cache. |
LoadReportDocument | When a ReportQuery is created by the ReportGallery, it will call LoadReportDocument to allow the Document to be populated from a database. If LoadReportDocument is not set or if LoadReportDocument does not load the ReportQuery’s Document property, then the Document will be loaded from the Url of a registered report. |
Methods
RegisterReport | Registers a report definition in the report gallery. |
GetReportList | Gets a list of registered reports. A report can have a group and a role specified which can be used when getting a list of reports. This list can then be used to create a report menu. Returns a list of ReportDefinition objects. |
RegisterReports | Registers all reports in the specified XML file. |
GetReportDefinition | Gets the report definition for the specified report code. |
GetReportQuery | Retrieves a report query from the cache. |
NewReportQuery | Creates a report query by loading the report definition for the specified code. If a reportId is specified, then the report query will use this id. |
NewPublishedReportQuery | Creates a report query by loading the report definition for the specified code and loading the specified published report data. |
Click to see Comments