markos17 Posted July 20, 2009 Share Posted July 20, 2009 I have created document with one parameter id_cycle (cycles names are January, February etc.) I can choose one from 12 cycles and report looks like this:name value cyclexyz 123 Janyzx 321 Janxzy 231 Jan Now, I would like to change it, so I can choose more than one cycle, eg. January, March and July.CYCLE: Janname value xyz 123 yzx 321 SUM: 444 CYCLE: Marchname value zzz 111yyy 222SUM: 333 CYCLE: Julyname value xxx 001zyz 100SUM: 101 I tried with grouping and cross table. I don't know how to do it, that I can choose more than one cycle (parameter)? What do You think? Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted July 20, 2009 Share Posted July 20, 2009 the parameter should be defined as Collection.If you are using an SQL query, there is a special syntax to deal with collection of value:SELECT id_cicle, name, value FROM myData where $X{IN, id_cicle, MY_COLLECTION_PARAMETER}I suffest then to order your data by id_cicle, so you can create groups based on an expression like:$F{id_cicle}Giulio Link to comment Share on other sites More sharing options...
markos17 Posted July 20, 2009 Author Share Posted July 20, 2009 Thanks for such quick reply! Could You explain me the syntax: $X{IN, id_cicle, MY_COLLECTION_PARAMETER} ? In the first version:xyz 123 Janyzx 321 Janxzy 231 Jan I had such code:SELECT cycle.cycle, name, value FROM myData WHERE cycle.cyle = $P{id_cycle}Parameter "id_cycle " had class: "Java.lang.String". Should I change "id_cycle" Parametr class from "Java.lang.String" to "Java.util.Collection"? What about MY_COLLECTION_PARAMETER? Should I create such parameter? What value does it suppose to have?I tried with such syntax, but with poor results:SELECT cycle.cycle, name, value FROM myDataWHERE cycle.cyle = $X{IN, id_cycle, MY_COLLECTION_PARAMETER} and BTW. Are You the author of this book: The Definitive Guide to iReport (Expert's Voice)? :)Post Edited by markos17 at 07/20/2009 13:32Post Edited by markos17 at 07/20/2009 13:33 Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted July 20, 2009 Share Posted July 20, 2009 Parameter: id_cylce_collectionType: java.util.Collection SQL query:SELECT cycle.cycle, name, value FROM myData WHERE $X{ IN, cycle.cyle, id_cylce_collection} order by cycle.cycleGroup expression:$F{cycle.cycle}When you pass a value for the parameter id_cylce_collection, it must be of type java.util.Collection (like a List or Vector).Giulio Link to comment Share on other sites More sharing options...
markos17 Posted July 21, 2009 Author Share Posted July 21, 2009 Thanks a lot, it works now! Link to comment Share on other sites More sharing options...
markos17 Posted November 12, 2009 Author Share Posted November 12, 2009 Hi, Recently, I was generating some reports and have notice some issue. When I use collection parametr, it generates a couple of columns. When there are plenty of them, some of them are moved under the first ones. Is it possible to display all columns in one level in Excel?Now, it looks like this: 2009-08-01 2009-08-02 2009-08-03 2009-08-04 2009-08-05 2009-08-06 A 0 0 0 0 0 0 B 0 0 0 0 0 0 2009-08-07 2009-08-08 SUM A 0 0 0 B 0 0 0 I'd like to change it into this: 2009-08-01 2009-08-02 2009-08-03 2009-08-04 2009-08-05 2009-08-06 2009-08-07 2009-08-08 SUM A 0 0 0 0 0 0 0 0 0 B 0 0 0 0 0 0 0 0 0 Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted November 12, 2009 Share Posted November 12, 2009 Yes, there is a property of the crosstab called Ignore Width Property. That's what you are looking for.Giulio Link to comment Share on other sites More sharing options...
markos17 Posted November 12, 2009 Author Share Posted November 12, 2009 Thanks, it works in ireport, but in my application it generates such error: "javax.servlet.ServletException: java.lang.Exception: an error occur during report generation: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'ignoreWidth' is not allowed to appear in element 'crosstab'" Do you think, that I have to do some soft updates? Link to comment Share on other sites More sharing options...
micwic Posted December 16, 2009 Share Posted December 16, 2009 Hello, i have the same problem.Where and how did you set ignore_width property in iReport ? I didn't find a way to set it correctly. Here the class definition with the property for crosstab. Note that this may be defined at report level too.http://jasperreports.sourceforge.net/api/net/sf/jasperreports/crosstabs/JRCrosstab.html 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