This chapter describes the report structure, available report objects and their properties. This is basically the JasperReports "Quick Reference" presented in the context of the JasperAssistant's user interface.
Before the report structure can be presented, the notion of expressions must be introduced. Expressions are the core feature of JasperReports. It is an important mechanism that allows to manipulate and display report data, perform various calculations, and customize the aspects and the visibility of report objects.
A JasperReports expression is basically a Java expression plus some additional syntax that allows to reference parameters, variables and fields. To refer to a parameter named DATA, the syntax $P{PARAM_NAME} is used. For variables and fields the syntax is $V{VAR_NAME} and $F{FIELD_NAME} respectively.
Expression syntax
Refer to the field named FIELD.
Refer to the variable named VAR.
Refer to the parameter named PARAM. Can be used to add parameterize the report's SQL query.
Refer to the parameter named PARAM. This is a special syntax that can be only used in report's SQL query. It allows to insert the parameter's content into the query string. For example it can be used to create a query with dynamic WHERE clause specified through a parameter.
Keep in mind that expressions are written in Java. This means that all the power of Java is at your disposal. The possibility of making method calls alone, allows to construct expressions of practically unlimited complexity. Note that the result of an expression is always an object.