Jump to content
We've recently updated our Privacy Statement, available here ×

how to convert string to collection


rbaudchon

Recommended Posts

Hi,

I have made a report with iReport 3.0.0 using a collection as parameter. This collection is a list of customer code that I want to keying manually. When I run the report from iReport, it works fine. I can put 1 or several code and I have my report.

I have created a new report unit in jasperserver. In the input control, I can not have a type "collections", only string. I have tried using string, but then I have an error message.

How can I convert string to collections in order to have my report running ?

I do  not want to have a input control based on a multiple query, because I have more than 2000 customers.

So, if you have any idea, it wiil be helpfull.

Thanks

Remi

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

One suggestion : not to use a collection but a string. If I well understand, you want to key manually  the ids or names of your cutomers, so you have to key something like :  " 1,2,3,....,N".

If you use a collection you certainly use the $X{} parameter syntax in your query.

My suggestion is to use a single value input control with string type and , when prompted, you key your list of values :

"1,2,3,..." and declare the parameter as string.

In your query you replace the $X{} by a "classical" sql clause : where userid in ($P!{StringListValue}) 

(notice the "!" after $P)

If you had not 2000 customers, you could use a multiselect query with a collection but you don't want.

Hope this will help

 

Link to comment
Share on other sites

no it doesn't work.

 

i have got java.sql.SQLException: ORA-00907: missing right parenthesis, when trinh to use "!" after $P.

I have create a new easy query as follow:

 

select

c.name as CustomerName

from

sbedba.cust c

where

c.code in ($P!{customerliststring})

Link to comment
Share on other sites

It's strange!  To be sure, I created a small report with only one detail band and one field "NomAct".

I defined the query as

"select lib_nom_act as NomAct from activite
where id_act in ($P!{ListAct})"

and defined a string parameter ListAct. and an Input control ListAct

I run the report; when prompted, I key : 1,2,3 and I get the right list of name activities without error.

So I don't understand why in your case it doesn't work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...