Jump to content
We've recently updated our Privacy Statement, available here ×

Need Help with Cascading Input Controls


manshack_one

Recommended Posts

I need to create some cascading input controls.  I'm running JS 3.7 RC.  Basically I have units (locations) that are broken down like this:  System > Division > District > Units.  The goal is to have 4 input controls that change as selections are made.  For instance a user could select a certain System and the corresponding Division, Districts and Units would populate, then by going further and choosing the Division they want the District and Unit lists would repopulate with the corresponding Units and finally by choosing the District the Unit list would repopulate again with the correct units.  Here's what I've done so far:

Queries:

HCD-system-select:

select distinct(system) from UNITS order by system;[/code]

HCD-divreg-select:

select distinct(divreg) from UNITS where $X{IN,system,HCD-system} order by divreg;[/code]

HCD-district-select:

select distinct(district) from UNITS where $X{IN,divreg,HCD-divreg} order by district;[/code]

HCD-unit-select:

select unitdesc from UNITS where $X{IN,system,HCD-system}   and $X{IN,divreg,HCD-divreg}   and $X{IN,district,HCD-district} order by unitdesc;[/code]

Input Controls (all multi-select queries, none are mandatory):

  • HCD-system, uses HCD-system-select
  • HCD-divreg, uses HCD-divreg-select
  • HCD-district, uses HCD-district-select
  • HCD-units, uses HCD-unit-select (only parameter in iReport, declared as collection)

Report Query:

Select tblUnit, vitals from CAD  where $X{IN,tblUnit,HCD-units};[/code]

My theory was that by using $X{IN} for each subsequent Input control that it would filter down as each was selected.  If a user wanted to see all Units (including all systems) they shouldn't have to choose any of the units.  I already have an input control that grabs the unit descriptions as a multiselect query and this works fine.  I built a test report in iReport and included HCD-units as a parameter.  I didn't include the other ones since they're only meant to be used in JS as filters for the HCD-units input control.  I uploaded the report to JS and added the other input controls in but when I try and run the report I get the following before seeing any input controls on the screen:

java.lang.NullPointerException	java.lang.NullPointerException	 at com.jaspersoft.jasperserver.war.action.ReportParametersAction.createWrappers(ReportParametersAction.java:487)	 at com.jaspersoft.jasperserver.war.action.ReportParametersAction.createWrappers(ReportParametersAction.java:401)	 at com.jaspersoft.jasperserver.war.action.ReportParametersAction.createWrappers(ReportParametersAction.java:106)	 at com.jaspersoft.jasperserver.war.action.ViewReportAction.checkForParams(ViewReportAction.java:171)	 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)	 at java.lang.reflect.Method.invoke(Method.java:585)	 at org.springframework.webflow.action.DispatchMethodInvoker.invoke(DispatchMethodInvoker.java:98)	 at org.springframework.webflow.action.MultiAction.doExecute(MultiAction.java:123)	 at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)	 at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)	 at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:79)	 at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)	 at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)	 at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)	 at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)	 at org.springframework.webflow.engine.State.enter(State.java:194)	 at org.springframework.webflow.engine.Flow.start(Flow.java:535)	 at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)	 at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)	 at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)	 at sun.reflect.GeneratedMethodAccessor293.invoke(Unknown Source)	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)	 at java.lang.reflect.Method.invoke(Method.java:585)	 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	 at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)	 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	 at $Proxy17.launchExecution(Unknown Source)	 at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)	 at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)	 at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)	 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)	 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)	 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)	 at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)	 at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)	 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)	 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)	 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)	 at com.jaspersoft.jasperserver.war.common.UploadMultipartFilter.doFilter(UploadMultipartFilter.java:83)	 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)	 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)	 at com.jaspersoft.jasperserver.war.security.JSSwitchUserProcessingFilter.doFilterHttp(JSSwitchUserProcessingFilter.java:146)	 at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)	 at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)	 at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)	 at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at com.jaspersoft.jasperserver.api.metadata.user.service.impl.MetadataAuthenticationProcessingFilter.doFilter(MetadataAuthenticationProcessingFilter.java:139)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at com.jaspersoft.jasperserver.war.util.RequestParameterAuthenticationFilter.doFilter(RequestParameterAuthenticationFilter.java:97)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)	 at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at com.jaspersoft.jasperserver.war.UserPreferencesFilter.doFilter(UserPreferencesFilter.java:175)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)	 at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at com.jaspersoft.jasperserver.war.UserPreferencesFilter.doFilter(UserPreferencesFilter.java:175)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at com.jaspersoft.jasperserver.api.logging.filter.BasicLoggingFilter.doFilter(BasicLoggingFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)	 at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)	 at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)	 at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)	 at org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99)	 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)	 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)	 at com.jaspersoft.jasperserver.war.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:67)	 at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)	 at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)	 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)	 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)	 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)	 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)	 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)	 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)	 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)	 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)	 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)	 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)	 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)	 at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)	 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)	 at java.lang.Thread.run(Thread.java:595)

Let me know what I'm doing wrong.  I've tried to follow the samples and the instructions on the wiki but can't seem to make this work.  Thanks in advance!

Robert

P.S.  I've attached the jrxml from iReport and the table showing the breakdown on units so you can see how they lay out.

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

I just installed an instance of jasperserver-pro-3.7 release, and I wanted to test the new cascading input controls functionality.
I am interested more in using the $P{LoggedInUsername} and $P{LoggedInUserTenantId} inside the query that drives a single select input control.
We used the first parameter ($P{LoggedInUsername}) in previous versions of JasperServer.

Right now it looks like none of the parameters listed here are working. Is there any special new syntax we have to use?
I tried $P{}, $P!{}, $X{} and the best result I got is the same exception posted at the beginning at this thread.
Is there any connection? Can somebody give me any pointers?

 

Exception is:

 

java.lang.NullPointerException	java.lang.NullPointerException	    at com.jaspersoft.jasperserver.war.action.ReportParametersAction.createWrappers(ReportParametersAction.java:521)	    at com.jaspersoft.jasperserver.war.action.ReportParametersAction.createWrappers(ReportParametersAction.java:437)

........................................................

Post Edited by rcandea at 01/04/2010 20:31

Post Edited by rcandea at 01/04/2010 20:32

Link to comment
Share on other sites

Do the reports work in iReport, that is without the cascading parameters?

 

Does the sample report with cascading controls work?

 

You have to have all the parameters related to the input controls in the JRXML. Try adding HCD-system, HCD-divreg and HCD-district.

 

 

Sherman

Jaspersoft

 

Link to comment
Share on other sites

Hello again Sherman.

The report does work in iReport.  After I upload the jrxml I add the input controls though the JasperServer interface.  They're all there.  System, Divreg, District and Units. 

I'm wondering though if it wouldn't accomplish the same thing to have 4 separate queries to pull distinct entries for each of those columns in the unit table and present them separately as multi-select input controls.  In my report query I'd have to use 4 $X{IN} statements I suppose.  My only problem is I have to match the unit description field to the corresponding System, Division and District so it's more of a join.

Link to comment
Share on other sites

  • 2 weeks later...

well, lo and behold I went back to my report, added the 3 other input controls then diagnosed an issue with one of the value/display columns and the darn thing started working. I had the queries a little off at first and needed to put a few "and" statements in my where clause for the unit level choice but it works.

 

This is a really cool feature. Sad thing is they'll probably want it on their other 25 reports now. :( Oh well, job security.

 

Thanks again for all the help.

Link to comment
Share on other sites

  • 4 weeks later...

While not straightforward, it can be done.

 

Create cascading controls that use a dimension table in the underlying OLAP database. Pass those parameters into the report. With a default expression or by direct substitution into the report query string, you can get the parameters to effect the query.

 

Like:

select [Measures].AllMembers on columns

[Location].[$P!{Country}].[$P!{State}].[$P!{City}].Members on rows

from Sales

 

You may need to do some additional massaging of the parameters to make them conform to MDX syntax.

 

Sherman

Jaspersoft

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...