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

2

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.

deepaknair.g's picture
Joined: Jul 28 2013 - 11:59pm
Last seen: 5 years 11 months ago

1 Answer:

0

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.

pdanyliuk's picture
Joined: Jan 24 2013 - 3:48am
Last seen: 4 years 8 months ago
Feedback
randomness