bartv2000 Posted May 7, 2014 Posted May 7, 2014 Hi,I'm new to jasper reports. I have created a simple report where data is extracted from a mysql database. No problem.But when I try to pass parameters to the report where a I want to filter the data with a IN clouse, I allways get all results or an error.This is my code:$controls = array('Parameter_1' => array('ANT' => 'ANT', 'LIE' => 'LIE')); $report = $client->runReport('/reports/Test/Formulier_0', 'pdf', null, $controls); header('Cache-Control: must-revalidate');header('Pragma: public');header('Content-Description: File Transfer');header('Content-Disposition: attachment; filename=report.pdf');header('Content-Transfer-Encoding: binary');header('Content-Length: ' . strlen($report));header('Content-Type: application/pdf'); But with this code the full report is given instead of the filtered reportWhen I change the array into $controls = array('Parameter_1' => array( 'ANT', 'LIE'));I get an error "Invalid type java.lang.String for parameter Parameter_1 used in an IN clause; the value must be an array or a collection." This is the report dataset: SELECT vzvb.cms_clubs.club_id,vzvb.cms_clubs.club_naam,vzvb.cms_clubs.club_nr,vzvb.cms_clubs.club_provinceFROM vzvb.cms_clubswhere $X{IN, vzvb.cms_clubs.club_province, Parameter_1} ORDER BY vzvb.cms_clubs.club_province ASC,vzvb.cms_clubs.club_naam ASC Parameter_1 is defined as a java.lang.String What am I doing wrong? Thanks in advance. Regards, Bart
gert_1 Posted December 13, 2014 Posted December 13, 2014 I think you gave the answer yourself, you said ' Parameter_1 is defined as as java.lang.String' and the error sais: ' Invalid type java.lang.String for P1 (..) value must be an array or a collection.' Can you try to change you parameterer type (can be found in properties of your param) to 'java.util.ArrayList' or 'java.util.Collection'. That should work, and if you only use Strings in the array/collection, you can define 'Nested subtype' to 'java.lang.String' so you don't have to define the type as well on each object.Can you let me know if it worked?
bartv2000 Posted December 28, 2014 Author Posted December 28, 2014 Hi Gert_1 I created a new report where I needed this and now it works. I think that the php array I was passing in the parameter was malformed or wrong... Thank you for the hint. Regards
gert_1 Posted December 29, 2014 Posted December 29, 2014 Hi bartv2000, No problem, glad to be helpful.Can you mark this answer as solution/ this topic as answered? Regards,
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now