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

Cascading Parameters


lovanc

Recommended Posts

I am trying to create a simple cascading parameter whihc I cannot get working. I am hoping that someone can spot the error in my configuration.

 

I created an Input Control called element_class as a "Single Select Query" type input control.

It runs the following query

select id as element_id, name as element_name
from element_class

to populate the selection list. The value column is "element_id" and the Visible Query Columns is "element_name"

 

This list populates successfully

 

The second Input Control is called "filtered_model_element". It is also a "Single Select Query" type input control.

The Query it runs is

select id as model_element_id
     , name as model_element_name
from model_element
where element_class = $P{element_class}
and entity_status is null

 

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 lovanc at 04/27/2011 13:43
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

I'm not sure about this, but if you don't mind experimenting, try $P!{parameter name} in the second query. Here is some documentation I gleaned from our JasperReports, iReport, and JasperReports Server Ultimate Guides:

When the value of the parameter is not a simple value, but a chunk of the query or the whole query, use:

$P!{parameter_name}

Use this syntax to indicate that the parameter does not have to be dealt as a value to transfer to a prepared statement, but that it represents a little piece of the query. The server does not bind the parameter to a SQL parameter. It calculates the value of the parameter and evaluates it as a raw subsection of a query.

For example, if you have a parameter named MyWhere with the value of "where
CUSTOMERID = 5", the query:

select * from customers $P!{CUSTOMERID}

will be transformed into:

select * from customers where CUSTOMERID = 5

without using the logic of the SQL parameter. Make sure that the parameter value is correct in order to avoid an error during the query execution



Post Edited by khahn at 05/01/2011 16:41
Link to comment
Share on other sites

well iovanc, ur mistake is that u wrote element_class = $P{element_class} in the where clause part of the query. if for every id in element_class param thery is a list of filtered_model_element then u should wrote:

model_element.id = $P{element_class}

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.

 

 

 

Link to comment
Share on other sites

Thanks for your interest in using JasperReports Server. Attached is a tutorial for creating a city-state cascading input control. If you need more detail, don't hesitate to ask. Good luck!



Post Edited by khahn at 08/13/2011 22:21



Post Edited by khahn at 08/13/2011 22:27
Link to comment
Share on other sites

  • 3 months later...

 Hello!!

I actually would like to explore the opposite scenario. I have a report that I need to disable the cascading efefct in my controls... for some reason my report gets the "thinking" pop-up every time I change a value in the controls even though I did not configure them for cascading. Is there a wway to prevent such behaviour???

Any help will be really appreciated!

Mario

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