Jump to content

Jasper Report With Dynamic Params


Recommended Posts

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 sjoin juror_subjects as js on js.resources_id = s.resources_idjoin resources as r on r.id = s.resources_idjoin matters as m on m.id = r.matters_idwhere r.id = $P{subjects_id}[/code]

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;}[/code]

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.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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