Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Parameter to IN clause
Parameter to IN clause [message #213593] Wed, 24 January 2007 09:39 Go to next message
Mathi is currently offline MathiFriend
Messages: 90
Registered: July 2009
Member
Hello folks,
I want to pass a parameter to IN cluse to the sql.

While designing, in dataset parameters I set the value as
15,16,17
I tried to preview, but it was giving less number of records than the
expected.
I tried like this also
'15','16','17' but the same result.
The query is

select * from ss where ss.sub_service_id in ( (?) )

Any idea how to set the default value or how to pass the parameters for IN
clause

Regards
Mathi
Re: Parameter to IN clause [message #213670 is a reply to message #213593] Wed, 24 January 2007 13:42 Go to previous messageGo to next message
Jonathan Brown is currently offline Jonathan BrownFriend
Messages: 22
Registered: July 2009
Junior Member
Can you write your IN clause as a subselect? That was how I did it when I
needed something similar.



"Mathi" <kavi_mathi@yahoo.co.in> wrote in message
news:16fe981ff35985265517cf169e428a9d$1@www.eclipse.org...
> Hello folks,
> I want to pass a parameter to IN cluse to the sql.
>
> While designing, in dataset parameters I set the value as 15,16,17 I tried
> to preview, but it was giving less number of records than the expected.
> I tried like this also '15','16','17' but the same result.
> The query is
> select * from ss where ss.sub_service_id in ( (?) )
> Any idea how to set the default value or how to pass the parameters for IN
> clause
>
> Regards
> Mathi
>
Re: Parameter to IN clause [message #213678 is a reply to message #213670] Wed, 24 January 2007 14:07 Go to previous messageGo to next message
Mathi is currently offline MathiFriend
Messages: 90
Registered: July 2009
Member
Hi ,
Thanks for the response.

Can I pass multiple values for that single parameter?
Could you plz post ur eg.

Thanks
Regards
Mathi
Re: Parameter to IN clause [message #213694 is a reply to message #213678] Wed, 24 January 2007 15:42 Go to previous messageGo to next message
Jonathan Brown is currently offline Jonathan BrownFriend
Messages: 22
Registered: July 2009
Junior Member
select * from ss where ss.sub_service_id in ( select ss.sub_service_id from
ss where someOtherColumn = ? )

Maybe that's not the clearest example but hopefully you'll understand the
gist of it. Mainly, you can use any arbitrary SQL statement in the
subselect. The subselect can reference other tables, columns, etc. and
should be whatever query you're using to get the sample values you provided
(15, 16, 17).

I don't know of any other way to configure a BIRT report to allow an
arbitrary number of parameters in a query (but I'm not an expert).

jb




"Mathi" <kavi_mathi@yahoo.co.in> wrote in message
news:e631af9bc4731396e5a15217ab290d1f$1@www.eclipse.org...
> Hi ,
> Thanks for the response.
> Can I pass multiple values for that single parameter?
> Could you plz post ur eg.
>
> Thanks
> Regards
> Mathi
>
Re: Parameter to IN clause [message #213911 is a reply to message #213694] Thu, 25 January 2007 05:41 Go to previous messageGo to next message
Mathi is currently offline MathiFriend
Messages: 90
Registered: July 2009
Member
Thanks JB ,
In this way only one parameter can be attached.I need to pass multiple
values to that single parameter.

Regards
Mathi
Re: Parameter to IN clause [message #213960 is a reply to message #213911] Thu, 25 January 2007 08:19 Go to previous messageGo to next message
ice70 is currently offline ice70Friend
Messages: 193
Registered: July 2009
Senior Member
if you wish to pass multiple value to a parameter, you can define the
parameter as an array, then you can retrieve multiple value.

is that what you want?
Re: Parameter to IN clause [message #214014 is a reply to message #213960] Thu, 25 January 2007 12:10 Go to previous messageGo to next message
Mathi is currently offline MathiFriend
Messages: 90
Registered: July 2009
Member
Can you put an eg . Or how to have an array as single parameter

Mathi
Re: Parameter to IN clause [message #214039 is a reply to message #214014] Thu, 25 January 2007 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aaaaa.xxx.com

Mathi,

The answr depends on whether you plan to use the BIRT Web Viewer or Custom
Parameter Screen, if you use the BIRT viewer there is NO way of passing
multiple values , other than letting user type comme delimited values fo
rthe input which would be impractical.

If you develop your own custom parameter screen, you can pass multiple
values for a given parameter.

Please look at the xample here...This uses a html page to call a servlet
with multiple parameter and thats the only way you can achieve that.

http://wiki.eclipse.org/index.php/Dynamic_Report_Servlet
Re: Parameter to IN clause [message #214270 is a reply to message #214014] Fri, 26 January 2007 00:20 Go to previous messageGo to next message
ice70 is currently offline ice70Friend
Messages: 193
Registered: July 2009
Senior Member
as i know, you can define your parameter as an array as below:


strYourParameter = params["YourParameter"].value;
arrYourParameter1=strYourParameter.split(",");

then you can call the YourParameter as below:

arrTitle1[0]
arrTitle1[1]
arrTitle1[2]
....

hope this can help you... ^o^
Re: Parameter to IN clause [message #216095 is a reply to message #213911] Thu, 01 February 2007 06:59 Go to previous message
Eclipse UserFriend
Originally posted by: mauro.tisc.edu.au

I have got around this problem by replacing the comma in the comma seperated
list with ','
For example, I enter a parameter such as 37,23,47,58

In the Edit Data Set window, Property Binding section, I modified the query
to:

"SELECT .... FROM ... WHERE id in ('" +
params["pID"].value.replace(",","','") + "')"

The javascript replace() method replaces all instances of , with ','

So the query string executed is changed from '37,23,47,58' to
'37','23','47','58' which produces the correct output.

Hope this helps
Regards MV


"Mathi" <kavi_mathi@yahoo.co.in> wrote in message
news:1399374fcde3240eb6ac135e26d0eff2$1@www.eclipse.org...
> Thanks JB ,
> In this way only one parameter can be attached.I need to pass multiple
> values to that single parameter.
>
> Regards
> Mathi
>
Previous Topic:pdf emitter
Next Topic:header-detail row on page break
Goto Forum:
  


Current Time: Fri Apr 26 14:50:52 GMT 2024

Powered by FUDForum. Page generated in 0.05310 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top