The support for Jasper Reports is provided by the reports Module of the Standard Library: the Module contains the reports function definition with the following functions:
Note: The LSPS Embedded Server integrates the Jasper Report library; hence no Jasper Server is called when working with the Embedded Server.
To work with Jasper Reports on a Jasper Server, you need to obtain access to reports on an external Jasper Server. You can do so with the jasperReportURL().
Example URL of a Browser Frame component that points to a report on a remote Jasper server with no parameters
jasperReportUrl(
"http://myremoteserverip:9090/jasperserver",
"jasperadmin",
"jasperadmin",
"/reports/MyReports/myReport",
false,
["topLimit"-> 120]
)
Important: Insert the full path to your report.
Path of the report in the web client
To enable data queries of Jasper Reports in Expression Language, do the following:
lsps-runtime/jasperreports-extension/lsps-tools-jasperreports-extension-<VERSION>.jar to the classpath of your Jasper server (you can download its latest version with dependencies here).Set the property com.whitestein.lsps.datasource.url to point to base URL to the RESTful API
For the Embedded Server, this would be set to http://localhost:8080/lsps-monitoring-ws/resources/report-ds/.
LspsExpressionLSPS_MODULE_ID or LSPS_MODEL_INSTANCE_ID to define the context for the report dataLSPS_USERNAME and LSPS_PASSWORDYou will typically display a Jasper report in a form using a Browser Frame or you will navigate away from the Document or To-Do to the report URL: On the Embedded Server, you can use the embeddedJasperReportUrl() which returns the URL of the JasperReport: The LSPS Embedded Server integrates the Jasper Report library; hence no Jasper Server is called.
To display your report in a Browser Frame, do the following:
embeddedJasperReportUrl(thisModel().name, "MyBamReport/HelloModel.jrxml", [ "editable"-> true])Forms.navigateToUrl((embeddedJasperReportUrl(thisModel().name, "MyBamReport/HelloModel.jrxml", [ "editable" -> true ])))When you request a parametric Jasper report with one of the reports function of the Standard Library, on runtime, the data type of the parameter value is converted to its Java equivalent:
| Expression Language Type | Java Type |
|---|---|
| String | java.lang.String |
| Integer | java.lang.Short |
| java.lang.Integer | |
| java.lang.Long | |
| java.lang.Float | |
| java.lang.Double | |
| java.math.BigDecimal | |
| Decimal | java.lang.Short |
| java.lang.Integer | |
| java.lang.Long | |
| java.lang.Float | |
| java.lang.Double | |
| java.math.BigDecimal | |
| Boolean | java.lang.Boolean |
| Date | java.util.Date |
| List | java.util.List |
| Set | java.util.Set |
To allow the user to export a Jasper Report into PDF, Excel, or Word and download it, call jasperReportExport() in a form component. The function returns a File with the report.
Example FileResource of a Download component with a PDF report
new FileResource(jasperReportExport(thisModel().name, "MyBamReport/HelloModel.jrxml", ReportFormat.pdf , [->]));
Example Click Listener of a Generate PDF button that generates the PDF report and sets the PDF Link component properties
{e ->
def FileResource pdf :=
new FileResource(
jasperReportExport(
thisModel().name,
"MyBamReport/HelloModel.jrxml",
ReportFormat.pdf,
[->]
)
);
PdfLinkComponent.setResource(pdf);
PdfLink.Component.setEnabled(true);
}