Problem using multi-select values in queries

Alvi
edited February 11, 2022 in Analytics #1
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

  • anthrotech
    edited December 31, 1969 #2
    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.
  • ericpias
    edited December 31, 1969 #3
    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.<br />
    <br />
    ids = reportContext.getParameterValue("MyMultiSelectParam");<br />
    queryString = this.queryText;<br />
    <br />
    if (ids.length > 0)<br />
    {<br />
    queryString = queryString + " AND column in (";<br />
    for (i = 0; i<ids.length; i++)<br />
    {<br />
    queryString = queryString + ids;<br />
    if (i+1 < ids.length)<br />
    {<br />
    queryString = queryString + ",";<br />
    }<br />
    }<br />
    queryString = queryString + ")";<br />
    }<br />
    <br />
    this.queryText = queryString;<br />
    <br />
    This is one way to solve it. There may be others.
  • Alvi
    edited December 31, 1969 #4
    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