Jump to content

Multi-Select parameter - default list question


nealhudson

Recommended Posts

Hi there,

 

I have a report which contains a java.util.Collection as an input parameter. I then use this in the SQL Query using the $X{IN, field, parameter} operation.

On JasperServer, I have set up a Multi-Select query input control which displays a list of possible values. Behind this there is a query to retrieve the info from the database.

 

I now want to use this report as a drill-down from another report, i.e. embed a hyperlink in the parent report. I would like in this instance for the multi-select input to be populated with ALL the values in the database.

 

I was thinking there would be some way of either setting up a subdataset in the parent or the child, entering the query in here to retrieve the list of values, and either sending it as the parameter in the hyperlink in the parent report, or using it as the default value in the child report.

 

What is the best way to go about doing this?

 

Thanks

Neal

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

JasperReports subdatasets can only be used currently for charts and crosstabs, and not for retrieving one or more values form the DB or other data sources.

 

However, if one uses $X{IN, column, parameter} with an empty/null parameter values, no filter will be applied so this would be equivalent (when the DB column does not contain nulls) to passing all the values in the parameter. So if you don't set any default expression for the parameter, the query will not contain any filter by default.

 

Regards,

Lucian

Link to comment
Share on other sites

Hi again Lucian

 

I just tried this with my report, I have set up the parameter not to be mandatory. When I click the hyperlink to go from the master report to the detail report, I get the following error:

net.sf.jasperreports.engine.JRRuntimeException: Multi parameters cannot contain null values.

 

The child report contains 2 parameters - the first is the collection, the 2nd is a Date. I'm filling the Date but not the collection.

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