Jasper Report With Dynamic Params

0

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.

jking_3's picture
Joined: Mar 17 2016 - 7:38am
Last seen: 3 years 7 months ago

1 Answer:

0

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

hozawa's picture
52642
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 1 week ago
Feedback
randomness