Jump to content
JasperReports 7.0 is now available ×

Input Parameter from list derived from query?


d.b

Recommended Posts

Building a report in jaspersoft studio 6.0.1 and pushing to jasperreports server 5.5.0.

The portion of query I am trying to get to work is 

"select state_name, count(1) from sales.by_state where ($P{chosen_states}='ALL' or state_name in ( $P{chosen_states} group by state_name))"

I would like to have an input parameter with a list of existing state_names that exist on the by_state table. Also, I would like to add to the checkbox list an "ALL" option which should return everything.

Is this possible?

 

 

----edit-----

I've changed my where clause to where $X{IN,state_name,chosen_states} and se the chosen_states parameter to java.util.List, which seems to help me get a little bit of the way there. Is there a way to dynamically populate the chosen_states with all that show in the query if running everything?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I was searching for an answer to do it all in Jaspersoft Studio, but I don't know if its possible. 

This is what I did:

  1. Sent report with parameter to jasperreports server
  2. Added a Query resource that got the distinct list of states from this table
  3. Edited the report's input control to read from the Query created, setting as type Mulit-Select Query

Would there have been a way to do this all in studio? It would be REALLY great to know, because it seems like everytime I update the report in studio and push it to the server, I have to reconfigure the input control. Very annoying!

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