Jump to content
Changes to the Jaspersoft community edition download ×

passing SQL query as arguments in runreport(args) Jasperserver PHP - REST client


deepaknair.g

Recommended Posts

Hi, 

I am new to Jasper. I have embedded it in my my PHP application. I was able to download the reports from jasperserver. But I couldn't find a method to generate report by querying with respect to our Database. How can I do that? Can I add SQL queries as arguments and generate report dynamically. Is it possible? or am I going through the wrong way? Any help is appreciated.

Link to comment
Share on other sites

  • 5 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hello. I don't think it's possible in JRS at all, regardless if using PHP client, any JRS API or UI.

The concept of report in JRS is that you already have a particular query tied to the data source this report is based on, and then you optionally specify parameters that you can pass; e.g. "select * from department as dep where dep.department_id=$P{department}". Then you create input controls for this report tied to each parameter, and when running this report, you specify parameter values (either type in or select an option from the list retrieved from DB — dependent on how you created your IC), and they get inserted in the query.

If you could pass a query, not only you would have made it very error-prone (as the user needs to know what fields with what names and types to return), but you also would have exposed your server to SQL injection attacks.

There is a possibility to override query in jrxml with query in report — if you have editing rights, you can set arbitrary query in Edit Report -> Query page. Maybe you find it helpful if you need to quickly override the query on the server for all users.

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...