Using the context in a report
JasperReports allows us to add parameters to a report and their values can be passed by the caller. For example, we can create a parameter, momId
, in the report and allow the user of the report to pass the value for it at runtime. Moreover, inside the report, different decisions (for example, filtering data) can be taken at runtime based on the parameter value. When we use a Jasper report inside ADempiere, it passes the following to every report:
Current context
Parameters specified in the report
RECORD_ID:
The primary key of the current record. This is passed asInteger
AP_INSTANCE_ID:
The ID of the current process. This is passed asInteger
CURRENT_LANG:
The current language. This is passed asString
While others are more straightforward, in this recipe, we will understand the steps it takes to use the ADempiere's current context in a Jasper report.
How to do it...
1. Launch ADempiere and click on the Tools | Preferences option on the top menu bar.
2. On the...