#1 2016-09-13 12:59:30

TZM
Member
Registered: 2016-08-23

How do I configure multiselect datasource param for a jasper report

Hi,

1.)

I need to configure a multiselect datasource param for my jasper report.

For example my column name is "Color" and the values in the column are red blue and green
In my jasper report the Where clause of my query goes ... and Color = $P{color}

In ReportServer the query for the datasource param is  : select distinct Color from Table
I choose Radio Button as my display preference.

The report returns a blank screen as output but it WORKS with Single Selection DS param or Text Param type.

Need help with this..


2.)

I also need assistance in giving an alias to the values a datasource parameter can take..

In the example illustrated in 1.)...if my database stores the values of these colors as 'R','B' and 'G' only. In my multiselect param values I'd like to replace these with aliases 'Red','Blue' and 'Green' respectively...so that its user friendly smile.

Is there a way I can do this. It would really help if I could as I dont want to add another column to the table in my DB. Thanks.

Offline

#2 2016-09-14 09:30:35

Thomas Davies
datenwerke
Registered: 2016-05-18

Re: How do I configure multiselect datasource param for a jasper report

Hi TZM,

TZM wrote:

I need to configure a multiselect datasource param for my jasper report.

The two most important things when using multiselect parameters with jasper are
a) to set the parameter class correctly to java.util.List
b) to make the comparison in the reports query using $X{IN...}

TZM wrote:

I also need assistance in giving an alias to the values a datasource parameter can take..
if my database stores the values of these colors as 'R','B' and 'G' only. In my multiselect param values I'd like to replace these with aliases 'Red','Blue' and 'Green' respectively

To have a separate display-value for the datasource parameter, the parameter query has to return an additional column. If two columns are returned, by default the first column is regarded as parameter value and the second one as display value. If you don't want to add this to your database you can of course use a case-when expression in the query to make the mapping on the fly.

Cheers,
Thomas

Offline

#3 2016-09-14 12:18:29

TZM
Member
Registered: 2016-08-23

Re: How do I configure multiselect datasource param for a jasper report

Hi Thomas,

That was extremely helpful. Thanks a lot.

TZM

Offline

#4 2020-10-25 23:20:27

aditi.raiter
Member
Registered: 2018-05-01

Re: How do I configure multiselect datasource param for a jasper report

When using multiselect datasource parameters chained together/dependent on each other, the downstream chain does not apply and save in variants.   

Example:  REGION / COUNTRY / CITY  If you select a region, it filters the Country list to matching countries for that region, and additionally, filters the cities to cities in those countries.  However, if you then select 1 or two countries and save the variant, when you pull the variant up again, for just a blink of an eye (seen best when changing to checkboxes), you can see the counties are still selected, however, the screen finishes loading and the countries end up not selected.

This chaining and save works when using a single select only.

For this we have used java.Lang.String datatype and not java.Util.List as mentioned above. Are we missing any jar files (say rt.jar) in any RS location?  Not sure if the bug is related to parameter type issue.

Last edited by aditi.raiter (2020-10-26 00:17:02)

Offline

#5 2020-11-05 10:05:19

eduardo
Administrator
Registered: 2016-11-01
Website

Re: How do I configure multiselect datasource param for a jasper report

Hi aditi.raiter,

thanks for sending this, we will look into this on RS-4424. We will update here when we have more information.

Regards,
Eduardo

Offline

#6 2022-03-01 13:09:58

eduardo
Administrator
Registered: 2016-11-01
Website

Re: How do I configure multiselect datasource param for a jasper report

Hi aditi.raiter,

this is fixed in the RS4.0.0-6057 Version released today.

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB