How to Add Readable Titles to Jasper Reports
TLDR; The video discusses adding a second query to a Jasper report to display a more readable title using data from a lookup table.
💡 Adding a Title with Data
When creating a report, it's common to want to add a title using data not found in the main query.
For instance, the video mentions a school system being returned as 'FCPS' in the result set, but the requirement is to present 'Frederick County Public Schools' in the title.
To achieve this, a lookup table in Access is used to run a second query as a subreport.
This allows the retrieval of a more readable description text based on the initial query result.
The report is developed and tested independently and is based on a single parameter system, 'NM', with a single band detail, removing all other bands.
🔄 Using a Subreport
The report uses a subreport for its title, where the subreport component is dragged onto the canvas.
The same connection as the larger report is utilized, and a parameter on the screen refers to the subreport's parameter.
To link up the subreport, a field from the query is used, and the subreport is fitted into the title band.
🔗 Linking the Subreport
In order to link up the subreport, a field from the query is used. The larger report runs a query with the school system value 'FCPS', which induces a second query coming from the subreport, returning the spelled-out 'Frederick County Public Schools'.