zamudio Posted September 10, 2009 Share Posted September 10, 2009 I am trying to run a report with a multi-select parameter in iReport 3.6 but cannot get it to run. Parameter name is EmployeeType of type java.util.Collection. My default value expression is java.util.Arrays.asList(new String[]{"Manager","General"})select Namefrom Table1where $X{ IN, EmpType, EmployeeType}In the Report Query window, I get an error message saying:Error: SQL problems: Line 3: Incorrect syntax near 'X'. If I try using $P I get the message:Error: SQL problems: The Java type java.util.Arrays$ArrayList is not a supported type. If I try using $P! I get the message:Error: SQL problems: Invalid column name 'Manager, General'.Any ideas on how to solve this? Link to comment Share on other sites More sharing options...
mdahlman Posted September 10, 2009 Share Posted September 10, 2009 zamudio, That's a bug in the "Report query" tab. Please enter a bug for it in the tracker. The work around is simple enough, but it's certainly annoying: 1. Do not use "Automatically Retrieve Fields" (I hate that option anyway.)2. Remove the $X syntax; click Read Fields; add the $X syntax back. The report works fine with $X syntax (both in iReport and in JasperServer). It's only the query panel that doesn't work correctly. Regards,Matt Link to comment Share on other sites More sharing options...
zamudio Posted September 10, 2009 Author Share Posted September 10, 2009 That works!One more question, how do you pass a Collection field to a dataset or a subreport?zamudio Link to comment Share on other sites More sharing options...
zamudio Posted September 12, 2009 Author Share Posted September 12, 2009 Found it! To pass a Collection parameter to a subreport or dataset enter it as the following expression: If your report language is Java, pass the parameter as $P{ParameterName}If your report language is Groovy, pass the parameter as $P{ParameterName}.toArray() zamudioPost Edited by zamudio at 09/12/2009 22:02 Link to comment Share on other sites More sharing options...
erhorn Posted February 1, 2010 Share Posted February 1, 2010 hi there!i'm trying to do the same thing as zamudio but in my case, the values are Integer.i created a parameter called "yearsCollection" of type collection and the Default Value set to new ArrayList(Arrays.asList( new Integer[]{new Integer(2008),new Integer(2009),new Integer(2010)} ))i have a column in my database called "year" of type int..i passed the parameter value to the query like this:$X{ IN, year, yearsCollection}when i run the report and in the prompt window i click in the "Use Default" button, the reports fills correct, but when i try to set values in the prompt text field (ex: 2008,2009) it crashes and the following error appears:Implicit conversion from datatype 'CHAR' to 'INT' is not allowed.=/, i read somewhere that the jasper assumes that the values datatypes passed to the $X{ IN, year, yearCollection} are supposed in the runtime, so i don't know how to manage this issue... i also tried this way: "year IN ($P!{yearCollection})" with no successi'm using iReports 3.7 and JasperServer 3.7 i hope someone can help me! Link to comment Share on other sites More sharing options...
asim1985 Posted September 12, 2011 Share Posted September 12, 2011 I am using $X variable but it gives me the error non supporet sql exception :IN i have to pass multiple parameter here i have tried many combinations of $X{IN,p.sac_no,SAC_NO} but cant get any idea.i ma using ireport 1.2.7.plz... hepl me if anyone knows . Code: Post Edited by asim1985 at 09/12/2011 06:35Post Edited by asim1985 at 09/12/2011 06:36 Link to comment Share on other sites More sharing options...
zamudio Posted September 12, 2011 Author Share Posted September 12, 2011 asim1985, Your SQL statement should look something like the statement below. When using $X you do not need to specify the IN sql operator before it. zamudioCode:and sp.fin_id=fm.fy_id /* after commenting records were came in large no i.e no of records increases */ /*and p.fin_id=fm.fin_id */ /* Reason for commenting fin id of property is null*/--and p.sac_no in(/*'BX1408080030000',*/'BX1408080110000'/*,'BX1408230020013','BX1408230020036','BX1408090000002','BX1408070070000','BX1408090000000'*/)and ($X{IN,p.sac_no,SAC_NO}) Link to comment Share on other sites More sharing options...
asim1985 Posted September 13, 2011 Share Posted September 13, 2011 he thanks zamudio my problem is get solved I have used $P!{parameter name} instead of $X{} and my problem get solved I dont need to change my data type it is java.lang.string thank you again for your help Link to comment Share on other sites More sharing options...
asim1985 Posted September 29, 2011 Share Posted September 29, 2011 use $P!{} instead of $X{IN,,} Link to comment Share on other sites More sharing options...
amatti Posted September 27, 2012 Share Posted September 27, 2012 Hi Everyone,I am using Jasper along with the Spring of Java.I am trying to pass parameter in the form of list. I hav used $X{}. in the iReport tool.My problem is When I select multiple locations from the front end. The can be fetched & set as the parameter but while filling the report, its throwing me the error saying, net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : atPureWeightat net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:123)at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:96)at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:100)at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:895)at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:860)at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:837)at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1434)at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:126)at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:836)at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:765)at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.fillReport(AbstractJasperReportsView.java:669)at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.renderMergedOutputModel(AbstractJasperReportsView.java:559)at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594)at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1365)at com.tf.retail.catalog.core.filters.SecurityDeligatingFilter.doFilter(SecurityDeligatingFilter.java:72)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)at org.eclipse.jetty.server.Server.handle(Server.java:351)at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900)at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954)at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)at java.lang.Thread.run(Thread.java:619)Caused by: java.lang.NoSuchMethodException: Unknown property 'atPureWeight' on class 'class java.lang.Integer'at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1322)at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:770)at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:111)at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:96)at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:100)at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:895)at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:860)at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:837)at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1434)at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:126)at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:836)at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:765)at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.fillReport(AbstractJasperReportsView.java:669)at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.renderMergedOutputModel(AbstractJasperReportsView.java:559)at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594)at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1365)at com.tf.retail.catalog.core.filters.SecurityDeligatingFilter.doFilter(SecurityDeligatingFilter.java:72)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)at org.eclipse.jetty.server.Server.handle(Server.java:351)at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900)at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954)at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)at java.lang.Thread.run(Thread.java:619) "atPureWeight" is one of the fields of my report & its datatype is java.lang.double. I cudn't figure out the cause plz help me in dis regard. And I am able to set the parameter from the front end properly. My code is as below; Connection connection = dataSource.getConnection(); parameterMap.put("REPORT_CONNECTION", connection); parameterMap.put("buId", bulist); Plz help me its very much needed. Any help is appreciable. Thank you. 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