user3860775
user3860775

Reputation: 25

Birt report Parameter allow multiple value

I have created a parameter type listbox where I have allowed to select multiple values. I want to use this parameter in the dataset. I used to accpet values in other dataset with StoredProcdureName(?,?) as parameter to SP. The problem with this filter is that it shows Selection if I select one or more values, but while passing to sp it sends only one value. How can I handle this?

Upvotes: 1

Views: 7182

Answers (1)

Dominique
Dominique

Reputation: 4332

You should at least post your stored procedure, such that we can see how this parameter is used. Multi-value parameters are processed by BIRT as java arrays, which is not a data type recognized by stored routines. This is why you only get the first item.

Therefore assuming this parameter is a SQL filter in a "IN" clause, we need to pass it to the stored procedure as a comma-separated String.

Declare your dataset parameter as String, and don't link it to a report parameter but set a default value expression based on the report parameter instead. In this example "myMultivalueParam" represents a numeric field in your database:

params["myMultivalueParam"].value.join(",");

If "myMultivalueParam" represents a String we need to add quotes:

params["myMultivalueParam"].value.join("','");

Then use this comma-separated string in your stored procedure.

Upvotes: 3

Related Questions