Saved Report and Scheduling Support for Jasper Reports
You can create Saved Reports for Jasper reports that is similar to Report Templates. These Saved Reports can be used to schedule the report execution by creating data monitors. Out of the box, there are no reports that support scheduled execution. The Jasper reports can be customized to configure scheduled execution.
You can create saved reports by using one of the following ways:
• The Jasper reports that require only scheduling: Saved reports can be created through the right-click menu action View Report. After selecting the criteria, saved reports are generated and are listed on the Reports page. These reports do not have input JSP to feed the criteria.
• The Jasper reports that require criteria from input JSP: You need to author a similar update criteria JSP to create saved reports with parameters.
After saved reports are created using any of the above options, creating data monitor-based scheduling is the same as report scheduling. For more information, see
Creating a New Data Monitor.
Customizing Criteria Based Reports
PTC provides a reusable component Create a Saved Report that can be integrated in any input JSP to perform saving of the reports with criteria.
Prerequisite
Report loader should have an additional field named csvCriteriaPage to include path of custom criteriaPage JSP. This JSP can be HTML, JS, Core-UI or Ext JS-based JSP. Report loader file should be similar to input JSP authored for those reports.
1. To use a reusable component, import the following tags and add to the input JSP where you want the button to be displayed:
◦ <%@taglib uri="http://www.ptc.com/windchill/taglib/saveCriteria" prefix="r"%>
◦ <r:saveCriteria savedReportName="SampleReportCriteria" prefix="r"%></r:saveCriteria>
The Save button appears after successfully adding the tag to the input JSP.
2. When you click Save, all input values from mainform (name-value) pair are considered as criteria for the saved report and the saved report is created. If the reportViewPort tag is used, then all input fields in the tag are considered as criteria. If the Input JSP does not include the reportViewPort tag, then HTML form name should be the same as mainform.
3. If you are required to author input JSP without the reportViewPort tag, then add all inputs in mainform.
4. To re-define or view the criteria, author a new JSP, and include the JSP in loader (criteriaPage).
5. API is provided to fetch criteria based on SaveReportOid. Save Report oid is available in your request parameters.
Request parameter example: String criteriaObjectOid=request.getParameter("saveReportOROid"); HashMap inputParams=SaveReportHelper.getReportCriteria(criteriaObjectOid);
6. Following table provides the Prog-Example:
Report Name | JRXML location | Loader location | Input JSP location | Required Reporttemplate QML location | Criteriapage location |
---|
ReportTemplateReportTask | <$WT_HOME> /prog_examples/JasperIntegration /JasperReports/Sample /ReportTemplateReportTask.jrxml | <$WT_HOME> /prog_examples/JasperIntegration /loadFiles/reports/jasper /loadReportTemplateReportTask.xml | <$WT_HOME> /prog_examples/JasperIntegration /netmarkets/jsp/report/jasper /ReportTemplateReportTask.jsp | <$WT_HOME>/prog_examples/JasperIntegration/loadFiles /reports/jasper/ ReportTemplateReportTask.qml | <$WT_HOME>/prog_examples/JasperIntegration /netmarkets/jsp/report/jasper/criteriaReportTemplateReportTask.jsp |
7. After the criteria is fetched, sanitize, encode and display the input JSP.
The Report Object Model is updated and the new column criteriaPage is added.
8. When you click a saved report, if report criteria is defined for Report Object, the defined criteriaPage is displayed, else Input Page is displayed.
9. To update the criteria in the criteria Page, use the following tags:
◦ <%@taglib uri="http://www.ptc.com/windchill/taglib/modifyCriteria" prefix="m"%>
◦ <m:modifyCriteria savedReportName="SampleReportCriteria_SR" divId="saveReportButtonDiv" ></m:modifyCriteria>
10. For any further modifications to the UI, you will need to perform the customization based on your business requirements.