In JasperReports, there’s a built-in parameter that user can use to limits number of records from the report data source during the report-filling process. REPORT_MAX_COUNT only controls the size of the resultant dataset from the data source. It is set BEFORE report query is executed and query resultant dataset feeds JasperReports to generate report output.
When a report uses table element to display report output and its deployed report unit is rendered in JasperReports Server web UI, user can use interactive JIVE feature to further sort the report data displayed in the viewer. However, the interactive sorting only goes after the report output. It is importance to realize that users can only use REPORT_MAX_COUNT and interactive sorting to display N number of records in ascending or descending order, where N number of records rely on user’s report query select order. Users will not be able to use REPORT_MAX_COUNT combined with interactive sorting to get the first N number, or last N number of records from the database to have them displayed in JRS report viewer.
REPORT_MAX_COUNT - JasperReports Ultimate Guide page 63, sheet 75
Interactive Sorting - JasperReports Server User Guide, Interactively Sorting a Report