Jump to content
Changes to the Jaspersoft community edition download ×

Limit number of rows to be fetched in query


psundaravaradhan

Recommended Posts

Am trying to limit the total rows to be printed in a report as a user defined function. select top $P{rowlimit} is something I can do in mssql. But this report could take any orcle datasource also. So is there a way to do this jasper level ? I read about report_max_count. But am not able to assign a value to this parameter.

Can you please suggest a way to achieve this in jrxml? I can't use report scriptlet or java code.

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

At the oracle plsql level you can set rownum <= x in the where clause in your jrxml file.  

The following will return 5 itemnames from an item table when the user enters rowlimit = 5:

 <queryString>
         <![CDATA[selectitemname from items where rownum <= $P{rowlimit};]]>
</queryString>
Hope this helps, 
Chris Kennedy
 
 

 

Link to comment
Share on other sites

Hi psundaravaradhan,

You are right. That's the only way to make it on Jasper level is giving a filter expression. But If you want to use like that and the result set has too many rows, some performance issue will come with it. Because when you giving a filter expression for the top records, reports show top records after fetching all the query results.

 

 

 
 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...