rida_10 Posted April 21, 2011 Share Posted April 21, 2011 Hi all,can we have cascading parameters in jasperserver that is the list of values for one parameter depends on the value chosen in preceding parameterthanks Link to comment Share on other sites More sharing options...
mdahlman Posted April 22, 2011 Share Posted April 22, 2011 Yes. Link to comment Share on other sites More sharing options...
rida_10 Posted May 5, 2011 Author Share Posted May 5, 2011 thanks mdahlman, i tried it and it works fine but for the cascading parameter report sample provided with the jasper server installation i was surprised that they use special syntax, so instead of writing: where id = $P{first_param},they wrote: where $X{IN, id, first_param}. So whats $X {...} represent. Link to comment Share on other sites More sharing options...
khahn Posted May 6, 2011 Share Posted May 6, 2011 The JasperReports Server Ultimate Guide explains it:The $X{} syntax is used when the value of a parameter is a collection. In the country/cities example, we can allow the user to pick any number of countries, and show all the cities in the selected countries. Now, the cities are selected in a multi-select input control that returns a collection, and the $P{} syntax is insufficient for substituting a collection into an SQL query. The $X{} syntax appears as follows:select city from ACCOUNTSwhere $X{IN, country, COUNTRIES}When the user selects the values Canada, Mexico, and USA in the COUNTRIES multi-select input control, the $X{} syntaxtranslates into the following query for the CITIES input control:select city from ACCOUNTSwhere country IN ('USA','Canada','Mexico')$X{} takes three positional arguments:* First is the collection operator, either IN of NOT IN.* Second is the table column that is being compared.* Third is the parameter that provides the collection of values, in other words, the name a multi-select input control.The number of parameters that can be used in a query is arbitrary, just as the number of input controls that can be defined in a report unit is arbitrary. Post Edited by khahn at 05/06/2011 21:22 Link to comment Share on other sites More sharing options...
rida_10 Posted May 9, 2011 Author Share Posted May 9, 2011 Okay !!, now i know the plain meaning of $X{...} expression,thanks kirstine Link to comment Share on other sites More sharing options...
honeybakliwal Posted August 11, 2011 Share Posted August 11, 2011 Heyllo everyone i tried cascading parameters and did the same thing what is explained in the cascading parameter example in the sample reports My Requiremnt is i having 2 parameter say State(java.util.collection type) which is of multi select query type and have query as select distinct Customer_State from customer order by Cutomer_State;Another parameter named as City (java.lang.String) which is of single select query which has query as select distinct Cutomer_City from customer $X{IN,Customer_State,State} This second input control does not populate when I select something form the first. I see the visual icon showing that the server is doing something but the list stays empty. Thank you in advance for your time.Post Edited by honeybakliwal at 08/11/2011 05:30 Link to comment Share on other sites More sharing options...
khahn Posted August 13, 2011 Share Posted August 13, 2011 Please see the attached tutorial about how to create a city-state cascading parameter similar to the one you describe. Thanks for your interest. Post Edited by khahn at 08/15/2011 22:12 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