Search code examples
sqljasper-reports

How to use SQL TOP command in jasper report?


How to get only first 5 records in iReport?

SQL query:

select top 5 * 
from [order]

This static query is working but this query with parameter in ireport doesn't work:

select top $P{NoOfRecords} * 
from [order]

Solution

  • Finally i got solution Take Report_Count variable and just set filter expression $V{REPORT_COUNT}<=$P{NoOfRecords}