JasperProcess

Top  Previous  Next

The JasperProcess element prepares the inputs of the JasperReports reporting engine in the runtime and calls it to generate reports in PDF, Text, Excel (xls or csv) and RTF formats.

JasperReports

Properties

Connection Name (Accepts MScript)

The name of the JDBC connection defined with "mor > RelDB > RelDBConnection" element in Common Definitions file. The JasperProcess uses this connection to obtain the data for the report.

Report File Name (Accepts MScript)

The name of a report file (either with jrxml or jasper extension) should be given.

Examples:
products.jrxml
invoice.jasper

Whether with jrxml or jasper extensions, all the Jasper files must be provided under {WEB_APPLICATION_ROOT}/WEB-INF/MM-INF/jasper-reports directory.

See Server Item Types for JasperReports

 
Report Query (SQL) (Accepts MScript)

The SQL query that access to the data base through the JDBC connection specified with Connection Name property retrieves the data to fill in the report. The SQL defined in this property overrides the SQL of the report template which was defined when preparing the template with iReport tool.

Using the MScript functions embedded in the SQL makes it possible to form the dynamic queries.  For example a request parameter called cat_id can be used in the query as follows:

Report Query (SQL)

SELECT * FROM products

@doif(cat_id != '')

  WHERE PCAT_ID = @vof(cat_id)

@doend()

 

Report parameters (Accepts MScript)

Any number of report parameters that are required by the report template can be defined in this property. Each parameter must be defined on a separate line in
PARAM_NAME = PARAM_VALUE format.

The PARAM_NAME is the name of the report parameter and the PARAM_VALUE should be an MScript expression.
 

JasperProcess Parameter Examples:

 
TITLE         = 'All Products'

SIGNED_BY     = SIGNED_BY

IMAGE_SOURCE  = filepath('WEB-INF/MM-INF/jasper-reports/jr_images/logo.gif')

MIN_PRICE     = f:MIN_PRICE

CATEGORY_ID   = v:CAT_ID

DATETIME      = fmtdate(now(),'dd.MM.yyyy')
 

 
Output Type (Accepts MScript)

This property defines the format of the output document. The supported formats are: 1. PDF, 2. Text, 3. Excel (xls), 4. Excel (csv), 5. RTF.

Only the number before the "." character is significant for defining the type. Should this value be defined dynamically with MScript the the resolved value must be a number between 1 and 5.

Example:

Output Type

@vof(OUTPUT_TYPE)

Otherwise JasperProcess throws an Exception.

 
Output File Name (Accepts MScript)

The name of the output document file. It can be the name of either a permanent or a temporary file.

Note that the temporary files are created under {WEB_APPLICATION_ROOT}/WEB-INF/MM-INF/~tempfiles directory and the names of the files are stored in pool variables or in process record fields. MoreMotion constantly scans the temporary files under this folder and deletes the expired files.

 

Examples:

Definition

Description

WEB-INF/reports/products.pdf 

The output file is permanent and it is defined relative to the web application root.

c:\reports\urun.pdf

The output file is permanent.

v:products

The output file is temporary. It will be created under {WEB_APPLICATION_ROOT}/WEB-INF/MM-INF/~tempfiles directory and its name will be stored in pool variable products.

f:order

The output file is temporary. It will be created under {WEB_APPLICATION_ROOT}/WEB-INF/MM-INF/~tempfiles directory and its name will be stored in process record field order.

 

Sub Reports

JasperReports supports Master-Detail reports through sub-reports.  A sub-report receives its parameters from the master report and lists the inner records accordingly.

Unlike the master report files that can be provided either as jrxml or jasper files, sub-report files can only be provided in jasper format.

A report parameter called "SUBREPORT_DIR" should be defined in the master report file and the name of the sub-report should be specified as
$P{SUBREPORT_DIR} + "sub-report-name.jasper".

The JasperProcess sets the value of this parameter as {WEB_APPLICATION_ROOT}/WEB-INF/MM-INF/jasper-reports/ in the runtime.

The Summary:

1.A parameter called SUBREPORT_DIR should be added to the master report
2.The name of the sub-report should be specified as $P{SUBREPORT_DIR} + "sub-report-name.jasper"
3.The both of the report files, the master report file (either with jrxml or jasper extension) and the sub-report file (with jasper extension) should be included into the project under the "jasper" folder. See "jasper" Server Item Type.
 
IncludeToPrj