I have a Report that I created in Jaspersoft Studio that has a parameter as part of the main dataset query:
SELECT * FROM subjects AS s JOIN juror_subjects AS js ON js.resources_id = s.resources_id JOIN resources AS r ON r.id = s.resources_id JOIN matters AS m ON m.id = r.matters_id WHERE r.id = $P{subjects_id}
when I preview this in Jaspersoft Studio, it prompts for the subjects_id, and once I enter it, the report runs successfully.
Also, when I run it on JasperServer, it prompts for the subjects_id, and once I enter it, the report runs correctly.
However, when I request it from our API (which is the ultimate implementation we are aiming for), it returns a blank page.
API code:
public function main(){ $inputControls = array( 'subjects_id' => 95488 ); $report = $this->c->reportService()->runReport('/reports/JurorReport', 'pdf', null, null, $inputControls); header("Content-Type: application/pdf"); echo $report; die; }
This API code is just for test purposes right now.
Can anyone help me understand why I am unable to request reports with $P parameters in the dataset query? I have confirmed that if I remove the parameters, the report runs correctly.
I appreciate any help you can offer.
1 Answer:
Use the REST API. Be sure to specify j_username and j_password in the URI so you'll be logged in. Otherwise, you'll just get a security error.
http://community.jaspersoft.com/documentation/tibco-jasperreports-server...