Working with Report Units
Up to now we focused on creating links of type Reference. Now let's create a hyperlink to invoke a JasperReports Server report, specifying which report, and setting values for its input controls. This mechanism requires that the report showing the report is executed in JasperReports server, so it may be considered a way to move from a report unit to another, realizing what is more generally called drill-down and drill-up (for example, I may want to click a bar in a bar chart related to a country to run a report that shows more about this country, or just details the number represented by the bar itself).
The execution of report units can be done by using hyperlink of type ReportExecution. This type requires to define a hyperlink parameter called “_report”, which holds the location of the report unit inside the JasperReports server repository.
Other hyperlink parameters can be defined to set values for input controls exposed by the report unit.
The next tutorial shows how to create a link to the report unit 04. Product Results by Store Type Report”, located at /public/Samples/Reports/4_Product_Results_by_Store_Type_Report.
When executed, this report can be filtered by country, anyway, since this report unit does not expose through input controls defined at report unit the country parameter, we cannot pass the country value we have.
1. | Create a new report, following the steps described at the beginning of this chapter (when we created a static link to http://www.jaspersoft.com) |
2. | Modify the # of orders measure by adding the following properties in the advanced properties tab: |
a. | hyperlinkType (contributor: SeriesItemHyperlink, Static value: ReportExecution) |
b. | hyperlinkTarget (contributor: SeriesItemHyperlink, Static value: Blank) |
c. | 3_report (contributor: SeriesItemHyperlink, Static value: /public/Samples/Reports/4_Product_Results_by_Store_Type_Report) |
3. | Publish the report in JasperReports Server and preview it on the web. Click a bar column to open the report units we defined in the previous step. |
Note that there is no special syntax to define a parameter, just use as property name the name of the parameter, and select the value (static, bucket or measure based).
The report unit 06. Profit Detail Report (/public/Samples/Reports/ProfitDetailReport) is a good candidate for this test. It exposes the parameter ProductFamily, so by adding the ProductFamily hyperlink property, and by setting it to a value like Drink, can pre-filter its results.
Measure Configuration for # of Orders |
Recommended Comments
There are no comments to display.