Jump to content

cascading parameters


rida_10

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

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

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 ACCOUNTS
where $X{IN, country, COUNTRIES}

When the user selects the values Canada, Mexico, and USA in the COUNTRIES multi-select input control, the $X{} syntax
translates into the following query for the CITIES input control:

select city from ACCOUNTS
where 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

  • 3 months later...

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

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...