kburns Posted February 21, 2011 Share Posted February 21, 2011 I have an input control query that returns a list of key/values pairs (id, label). I need to create a multiple select checkbox, but I am having a terrible time figuring out how this seemingly simple task. The value column = xyz The visible query column = abc Type = Multi-select query (check box)In the report query dialogue I have tried creating this parameter several time and it always shows up as "java.lang.NullPointerException". Here is what I do:Go to the right side and click "new parameter" Parameter name = xyz OR abc (both cause the error) Value expression = java.util.List OR java.lang.Object (both cause the error) Default value expression = I've tried leaving it blank or using "select top 1 id, label from my_table" (both cause the error)Please tell me what it is that I am doing wrong here.I can't find any explanations online, in these forums or in the documentation so at this point I am just banging my head against a wall.thx. Link to comment Share on other sites More sharing options...
kburns Posted February 21, 2011 Author Share Posted February 21, 2011 Or perhaps i've overlooked some place that documents this? Link to comment Share on other sites More sharing options...
mdahlman Posted February 22, 2011 Share Posted February 22, 2011 This is harder than it ought to be. First, for a multiselect parameter you should indeed use a java.util.List. Give it a default value like this: java.util.Arrays.asList(new String[]{ "Canada", "Mexico" })I'll call the parameter "MyParam". The input control should therefore be named "MyParam". It seems like you may be equating the column name with the parameter name, so this may be a second source of trouble.Normally for a multiselect value like this you just want a list of IDs. Therefore showing abc as the visible column and xyz as the value column are reasonable. Unfortunately these don't match with your query which doesn't have an 'abc' or 'xyz' anywhere to be seen. Presumably you have actually used 'id' and 'label' as your value and visible columns.But you write that you want to return key/value pairs. This would be quite different. Do you really need that? Or are you ok with a list of IDs?Regards,MattP.S. Coincidentally, I entered an enhancement request to make it easier to work with Collections last week. If it covers the type of thing you need, then you should vote for it:http://jasperforge.org/plugins/mantis/view.php?id=5085 Link to comment Share on other sites More sharing options...
kburns Posted February 22, 2011 Author Share Posted February 22, 2011 mdahlman - Thanks for the help! This makes a lot more sense. I mispoke when I said "key/values pairs". What you described is what I was aiming for. My main problem was in confusing the column and parameter names. After fixing that I was able to use the $X{IN, asdf, qwerty} syntax successfully.As a follow up question, I'd like to display the list of user selected values. I tried simply doing $P{MyParam}, but it spit out the selected IDs. And if possible it would be great to display them not just as ".toString()" output. For example:["CHOICE 1","CHOICE 4","CHOICE 45","CHOICE 60"] Link to comment Share on other sites More sharing options...
butlerc Posted March 24, 2011 Share Posted March 24, 2011 kburns - Did you figure this out in the end, how to display the visible values in your report output as opposed to the value? As this is something i am having trouble with myself, if you have a solution please would you share this with me. Many ThanksChris Link to comment Share on other sites More sharing options...
kburns Posted July 20, 2011 Author Share Posted July 20, 2011 Hi butlerc - No, I haven't been able to figure this out and am just now returning to the problem. If anyone case shed some light that would be much appreciated. Thanks! Link to comment Share on other sites More sharing options...
pjamack Posted July 20, 2011 Share Posted July 20, 2011 After using this product for a short time, it's obvious JasperReports isn't ready for 'prime time' usage. The forums are rather useless as most questions go unanswered or unresolved. I can't tell you how many times I've searched on google and found unanswered questions. Either people don't care, are rude, or nobody really knows. Many posts link to long gone pages or something posted from 2006. And if it were something different, I'd say you could work around it, but it's reporting. I won't even go into the other products. Reporting isn't about technology. It's not about spending months figuring out how to configure some radio list or how to work around the lack of dynamic columns. Rather simple reporting tasks just aren't that simple in Jasper. Even migrating reports from old systems to new ones is a major hassle and undertaking. At the end of the day, reporting is about getting results to business users. If it takes you soo long figuring out that "arial" isn't supported or you have to write some code to work around the lack of this or that, it's just not worth it. The joke I'm hearing is people write code to avoid dealing with JasperReports lack of common reporting functionalities. People have written their own reporting engines to get around simple tasks Jasper can't seem to do. It really should be as easy as 1-2-3 to build reports, get them out there, and move on to the next issue. Reporting should never be about the technology. It seems with Jasper, it's all about the technology and figuring out this fix or this problem or creating a work around. If you work in the corporate world or any world for that matter, nobody cares about a lack of dynamic columns unless you write some code. It's a report. It shouldn't be this complicated. And so far, JasperReports is just not a very good tool for most companies. Especially companies where developers don't have access to the server functions and report developers aren't the programmers and don't have access to eclipse, etc. Yeah play around with it at home, but I wouldn't use it in the corporate world. It' s just not that good. If I have to waste time writing code to work around an issue instead of working on a report or working on business code, it kind of is a waste of time.Post Edited by pjamack at 07/20/2011 22:29 Link to comment Share on other sites More sharing options...
mdahlman Posted July 21, 2011 Share Posted July 21, 2011 It sounds like JR may not be a good fit for your needs.I think that after "using this product for a short time" it's perhaps premature to claim "JasperReports is just not a very good tool for most companies". It's in production in hundreds of thousands of deployments.If you need a screwdriver, it doesn't necessarily mean hammers are poorly constructed and useless.Regards,Matt Link to comment Share on other sites More sharing options...
pjamack Posted July 21, 2011 Share Posted July 21, 2011 It's reporting. If you read half the forums, many people have similar problems that go unresovled or unanswered. If you start talking to people who actually have heard of JasperReports and those who use it, there are very few people who actually give it good remarks. It seems many people create work arounds for it's many limitations. I've used many products over the years and in the end, Reporting isn't about the technology. It's about getting the right reports to the right people with the right information. From my experience and from many people I've spoken to recently, JasperReports can't do the simple Reporting job very well. So yes, if you need a screwdriver, you should find a screwdriver. But if the screwdriver doesn't do it's job very well, that's a problem. 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