Skip to main content
Version: 7.0

JRXML report templates

A JRXML report template is a JasperReports template that the platform fills with the data of a form's report.

Fields​

The class attribute of a field element specifies the Java class in which the platform supplies the field value.

Property classField class
INTEGER, YEARjava.lang.Integer
LONGjava.lang.Long
DOUBLEjava.lang.Double
NUMERICjava.math.BigDecimal
BOOLEAN, TBOOLEANjava.lang.Boolean
STRING, ISTRING, BPSTRING, BPISTRING, TEXT, RICHTEXT, HTMLTEXT, JSON, JSONTEXT, XML, HTML, TSVECTOR, TSQUERY, LINK and the links to files of a specific typejava.lang.String
DATEjava.time.LocalDate
TIMEjava.time.LocalTime
DATETIMEjava.time.LocalDateTime
ZDATETIMEjava.time.Instant
INTERVAL[DATE], INTERVAL[DATETIME], INTERVAL[TIME], INTERVAL[ZDATETIME]lsfusion.interop.form.property.cell.IntervalValue
COLORjava.awt.Color
IMAGEFILEjava.io.InputStream
FILElsfusion.base.file.FileData
NAMEDFILElsfusion.base.file.NamedFileData
RAWFILE and the other files of a specific type (PDFFILE, JSONFILE, ...)lsfusion.base.file.RawFileData
a user class, including the <object name>.object field of an object of a user classjava.lang.Long with the id of the object
the <object name>.object field of an object of a built-in classthe field class of that class by the rows above

For dates and times, JasperReports applies the text field's pattern attribute to java.util.Date values. The automatic design converts values from java.time in text field expressions.

Property classExpression in the automatic design
DATEjava.sql.Date.valueOf($F{date})
TIMEjava.sql.Time.valueOf($F{time})
DATETIMEjava.sql.Timestamp.valueOf($F{dateTime})
ZDATETIMEjava.sql.Timestamp.from($F{zDateTime})

A custom template can declare the field as java.util.Date for any of these four classes, as java.sql.Time for TIME, or as java.sql.Timestamp for DATETIME and ZDATETIME. The platform converts the value to the declared class.

An image field declared as <field name="photo" class="java.io.InputStream"/> receives an image stream or NULL when there is no image. Use $F{photo} as the image expression. Declaring <field name="photo" class="lsfusion.base.file.RawFileData"/> gives the template the file itself. Use $F{photo} == null ? null : $F{photo}.getInputStream() to get its stream.

The platform removes trailing spaces from string values.

Subreports​

Declare three parameters in the parent template for each subreport. The <subreport ID> is the name of the subreport's first object group, which is also the postfix of its default template name. Reference each parameter with $P{...} in the corresponding element of subreport.

Parameter nameClassValueExpression element
<subreport ID>_reportnet.sf.jasperreports.engine.JasperReportCompiled subreportsubreportExpression
<subreport ID>_sourcenet.sf.jasperreports.engine.JRDataSourceSubreport data sourcedataSourceExpression
<subreport ID>_paramsjava.util.MapMap of subreport parametersparametersMapExpression

Properties in columns​

In a text field for a property with the COLUMNS option, write the field reference without an index. The platform appends the zero-based column index in the copied expressions. For example, it converts $F{price} to $F{price[0]}, $F{price[1]}, and so on.

To lay out several text fields as a block, set the same key on their reportElement elements. For example, set key="prices" on text fields that show $F{price.header} and $F{price} in the same band.

Additional fields​

Each of these form options supplies the value of its property in an additional field. Choose the Java class of the field from the class table using the option property's class.

Form optionField name
HEADER<field name>.header
FOOTER<field name>.footer
BACKGROUND<field name>.background
FOREGROUND<field name>.foreground
IMAGE<field name>.image

Property visibility​

The automatic design declares the <field name>.showif field for a property with the SHOWIF option. In a custom template, declare that field to use the option and choose its Java class from the class table using the visibility property's class.

For the removal rule to match a text field, write its text field expression as exactly $F{<field name>}.