Problem using multi-select values in queries

AlviAlvi Junior Member
edited December 31, 1969 in Designing Analytics Reports
We have successfully created and tested a report in Birt v. 2.2.2 using "single-value" input-parameters with our report-query.
We are now trying to use "multi-value" input parameters, but we have problems understanding how to embed the parameters into our query in a correct manner.

The following explains what we have done so far:

1) we created a query with one "?" (se query below)
2) we created one multi-value parameters in the "report paramaters" view named "testparameter" ("dynamic", "allow multiple values")
3) we created one input-parameter in the "edit dataset"-view named "testinputparamter" and set the "default value"-property to the previously generated parameter (see 2 above)
4) we then tried to preview the report, but then we received an errormessage that says "Can not convert the value of [Ljava.lang.Object;@170a5ee to Integer type"

How can we create and use multi-value input-parameters in queries correct? It looks like the multi-value-parameter returns an object of type "object", but we need to access the actual selected values in our query..
Any feedback on this is appreciated. See our stripped down SQL-query (with parameter) below:


select
h.id as helseforetak_id, h.navn as helseforetak_navn, h.region_id as helseforetak_region_id
from
helseforetak h
where
h.id in (?)
;

Comments

  • anthrotechanthrotech Junior Member
    edited December 31, 1969
    Sorry, but the column in (?) doesn't work in BIRT.

    You have to use either Property Binding or beforeOpen script option, of which neither has worked successfully for me either.

    But at least letting you know that column in (?) doesn't work and not supported. Only column = ? is supported.
  • ericpiasericpias Junior Member
    edited December 31, 1969
    I solved this problem in with a script on the dataset that appends on to the end of the sql query. I put it on "BeforeOpen". I used something like this for the script.



    ids = reportContext.getParameterValue("MyMultiSelectParam");

    queryString = this.queryText;



    if (ids.length > 0)

    {

    queryString = queryString + " AND column in (";

    for (i = 0; i
    {

    queryString = queryString + ids;

    if (i+1 < ids.length)

    {

    queryString = queryString + ",";

    }

    }

    queryString = queryString + ")";

    }



    this.queryText = queryString;



    This is one way to solve it. There may be others.
  • AlviAlvi Junior Member
    edited December 31, 1969
    Thanks For reply. Its work now. Can you please tell me how I can format parameter window. like size of the window, color, font size etc

    Regards,
    Alvi
Sign In or Register to comment.