Creating a sql select with an IN clause [message #210437] |
Wed, 10 January 2007 14:21  |
Eclipse User |
|
|
|
I have numerous reports that use a list of values that are inserted into
a sql IN clause. Example 'select a, b from c where d IN (e, f, g)'
I know that BIRT does not currently support passing multiple values in a
single parameter. I also want to use the viewer due to it's
functionality. Is there any way to use session parameters in the select
statement? My thinking is that I can do something like:
session.setAttribute("values", "e, f, g");
and then forward to /frameset?__report=report.rptdesign
where the report design would insert the values of session attribute
'values' into the select statement. Something like 'select a, b from c
where d IN (' + params["values"] + ')'.
Is this even possible? And if so, what is the correct way to access
session attributes in the select statement?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Creating a sql select with an IN clause [message #213903 is a reply to message #213726] |
Thu, 25 January 2007 00:38   |
Eclipse User |
|
|
|
Hello Jason,
The sql used is
select
item_feature.item_id
from
item_feature,
service_model,
item
where
item_feature.item_id = item.item_id and
item_feature.service_model_id = service_model.service_model_id and
service_model.sub_service_id in(17,15,16) and
group by
item_feature.item_id
having
count(item_feature.item_id) > 2
Here instead of 17,15,16 I want to pass a prameter . And more over in the
parameter the number of values are not fixed. It may be 18,19,20,25..
also . How can I do this?
Thanks
Regards
Mathi
|
|
|
Re: Creating a sql select with an IN clause [message #214111 is a reply to message #213903] |
Thu, 25 January 2007 11:22  |
Eclipse User |
|
|
|
You can add a string parameter that has a value of 17, 15, 16 .... and
modify the queryText using property binding
or script. Take a look at this example video.
http://www.eclipse.org/birt/phoenix/examples/reports/birt2.1 /querymod/index.php
Jason
"Mathi" <kavi_mathi@yahoo.co.in> wrote in message
news:75288128e5ec45bd373ff207b2f8b128$1@www.eclipse.org...
> Hello Jason,
> The sql used is
> select item_feature.item_id
> from
> item_feature,
> service_model,
> item
> where item_feature.item_id = item.item_id and
> item_feature.service_model_id = service_model.service_model_id and
> service_model.sub_service_id in(17,15,16) and
> group by item_feature.item_id
> having count(item_feature.item_id) > 2
>
>
> Here instead of 17,15,16 I want to pass a prameter . And more over in the
> parameter the number of values are not fixed. It may be 18,19,20,25..
> also . How can I do this?
>
>
> Thanks
> Regards
> Mathi
>
|
|
|
Powered by
FUDForum. Page generated in 0.13767 seconds