manshack_one Posted September 26, 2016 Share Posted September 26, 2016 I'm trying to run a query in my report that includes a "where columnname IN (1,2,3)" by using "$X{IN,columnname,parametername}". I created a parameter in Jaspersoft Studio as a collection. Once I publish the report to JasperServer then I know I'm supposed to create an input control on the server that matches the name of the report parameter. My problem though is from what I've read I'm supposed to create a multi-select input control however when I'm creating the control the dialog wants you to select a data type or list of values right then and I don't know what to tell it to use.Also, what format should my string be in that I'm passing to the $X{} parameter in my URL report call? (1,2,3) or leave off the parenthesis? I can build the string pretty much any way I need to. Right now everything I throw at it is not being recognized so the query builder uses 0=0 for my $X{IN} clause and pulls everything in the tables. Link to comment Share on other sites More sharing options...
kkriplani Posted September 27, 2016 Share Posted September 27, 2016 The url build should be something like below;http://localhost:8080/jasperserver-pro/report......&p_para=2&p_para=3&p_para=4where p_para is the collection parameter. Link to comment Share on other sites More sharing options...
manshack_one Posted September 28, 2016 Author Share Posted September 28, 2016 How do I create the input control on JasperServer since the input is in the URL? There isn't a collection data type in the repository resources. If i set it to multi-select then you can't save the control without listing a set of values. Link to comment Share on other sites More sharing options...
kkriplani Posted September 28, 2016 Share Posted September 28, 2016 Create the input control using studio. The input control id should be same as the parameter name. For multiselect, you can either chose a list of value or pass a query using which the input control will be populated from the db. EDIT (ON september 29th):Since you have gladly marked your own answer right I am commenting here.let me warn you that conditional parameter method that you have used will give you an issue. What if the user hasn't selected any value.Your IN condition will look something like;"Where p_para IN ();"Which is surely bound to give an error. But using a collection parameter (& multi select input control), in such a case would replace the whole string with;"Where 0=0"Choice is yours. Link to comment Share on other sites More sharing options...
manshack_one Posted September 28, 2016 Author Share Posted September 28, 2016 I'm following along with you but I'm at this point in studio creating the input control. I've named it the same as the parameter in the report itself. However, since this input control is not going to be visible (because I want to use the http repository api) the user will never have the option to enter the values. The values will come from the URL string I'm building inside my application. So what do I use at this point to get Server to let me use a multiselect without creating the list of values at this point? Link to comment Share on other sites More sharing options...
Solution manshack_one Posted September 28, 2016 Author Solution Share Posted September 28, 2016 I switched to using $P!{} and passed in a literal "(1,2,3)" in my URL and used a string input control on Server and changed my report query to something like "where r.attendee IN $P!{parameter_name}" and it works fine now. Thanks for the reponses regardless. Link to comment Share on other sites More sharing options...
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