n0n00b Posted March 22, 2008 Share Posted March 22, 2008 I use a "multi select query" in Jasperserver to get the parameters i use in a report designed with ireport. Select for parameters - "multi select query"Select id from sales_person Select in the reportSELECT sales_person.`id` AS sales_person_id, sales_person.`last_name` AS sales_person_last_name, sales_person.`manager_id` AS sales_person_manager_idFROM `sales_person` sales_personWHERE sales_person.id in ($P!{ID}) i added the parameter in ireport. First i am not sure which parameter class typ i should use?! integer ? I also get errors like Cannot convert input value "[8]" of type org.apache.commons.collections.set.ListOrderedSet to a numerical parameterTIA for any help Link to comment Share on other sites More sharing options...
Lazarus Long Posted March 23, 2008 Share Posted March 23, 2008 Your query can be ...sales_person.id in ($P{ID}) just make the ID parameter a string then pass a list of numbers separated by commas, like "1,2,3". Link to comment Share on other sites More sharing options...
n0n00b Posted March 23, 2008 Author Share Posted March 23, 2008 can somebody please give me a step-by-step help how i can make the IDs to a string.I'm playing around now for more than 4 hour .... without any luck.Where can i make the convertion ?Can i make it in ireport or do i have to edit the xml manually ? TIAPost edited by: n0n00b, at: 2008/03/22 18:56 Link to comment Share on other sites More sharing options...
donagha Posted April 22, 2008 Share Posted April 22, 2008 I solved it by creating a 2 parameters: ID as java.util.CollectionID_STR as java.lang.String edit ID_STR default and add the following expression:$P{ID}.join(",") use $P{ID_STR} in your query. I was able to execute the report with and without '!' Link to comment Share on other sites More sharing options...
donagha Posted April 22, 2008 Share Posted April 22, 2008 Correction to my last statement. You do need '!'. In my haste I wasn't thorough in my testing. The '!' transposes the ID_STR string into a list of integers in the query. I'm only supposing this, but it does provide the correct results.Post edited by: donagha, at: 2008/04/22 12:53 Link to comment Share on other sites More sharing options...
umair Posted May 7, 2008 Share Posted May 7, 2008 This join() function is'nt of java.util.Collection.Which Class does it belong to ??? I tried using org.apache.commons.lang.StringUtils.join(java.util.Collections,char) but this one also does'nt give the required results. The required result should be... e.g: Code:'str1','str2' But all these examples...which you also stated, would return, Code:[code]'str1,str2' This returns an empty report. Post edited by: umair, at: 2008/05/07 12:59Post edited by: umair, at: 2008/05/07 15:04 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