JasperFillProcess

Top  Previous  Next

JasperFillProcess utilizes the JasperReport processor to generate a report output in "jrprint" format. The jrprint is generated by filling a report document either in jrxml or jasper format.

Two or more output files in jrprint format can later be merged by JasperMergeProcess into one single output document (PDF, Excel, etc)

Place this element into a ProcessForm and define its properties as follows.

JasperFillProcess_elm

JasperFillProcess

 
Properties

Connection Name (Accepts MScript)

The name of the JDBC connection defined with "mor > RelDB > RelDBConnection" element in Common Definitions file. The JasperFillProcess 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) that exist under the JasperReport Files folder should be given.

Examples:
products.jrxml
invoice.jasper

 
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.
 

JasperFillProcess 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')
 

 

Sub-Report Connection Parameters (Accepts MScript)

The defining this property is meaningful if the report has sub reports and one or more sub-reports use a jdbc connection different than the master report's connection. There must be a report parameter with the same name in the JasperReports report and its class must be "java.sql.Connection".

The value of the parameter must be the name of a "RelDBConnection" element configured in the Common Definitions page.

JasperProcess Sub-Report Connection Parameter Examples:

SUBREP_CONN_DERBY = 'Derby'

SUBREP_CONN_ORACLE = 'Oracle'

 

Explanations: There must be two report parameters with name SUBREP_CONN_DERBY and SUBREP_CONN_ORACLE in the JarperResports report and their classes should be "java.sql.Connection". There must be two connection definitions with name 'Derby' and 'Oracle' that was defined with "mor > RelDB > RelDBConnection" element on the Common Definitions page.

 

Fill Id (Accepts MScript)

The reports that supposed to go into the same output document must be grouped with this identity.

Sub Report Directory (Accepts MScript)

This property is meaningful for the reports that use sub-reports. If the sub-reports exist under the default directory "{APPLICATION_ROOT_FOLDER}/WEB-INF/MM-INF/jasper-reports" then "Use_Default_Directory" must be selected as the value.

If the sub-reports exist as temporary files then the value should be "WEB-INF/MM-INF/~tempfiles".

Otherwise a relative or absolute directory name can also be defined.

 

Page Numbers

 

Get Page Count (Accepts MScript)

If the output document consists of more than one report, then the calculating the total page count is a little bit tricky. To do that this process must be execute two times, first with this property set to true and second with this property set to false. When this property is true then the pages are counted and maintained in the report parameters defined with the following two properties. These parameters will contain the actual values (Total Page Number and Start Page Number) in the second  pass.

If you have no intention to get the total page count then set this property to false and call it only once.

 
Total Page Number Parameter Name (Accepts MScript)

If "Get Page Count" property is true then the report parameter whose name is given here will contain the total page count. Its class must be "java.lang.Integer".

 

Start Page Number Parameter Name (Accepts MScript)

If "Get Page Count" property is true then the report parameter whose name is given here will contain the start page number. Its class must be "java.lang.Integer".

This value should be added to the current page number as follows.

$V{PAGE_NUMBER} + $P{START_PAGE_NUMBER}