Jump to content

Problem with JasperServer-parameter ( and ireport


n0n00b

Recommended Posts

I use a "multi select query" in Jasperserver to get the parameters i use in a report designed with ireport.

 

Select for parameters - "multi select query"

Select id from sales_person

 

Select in the report

SELECT
sales_person.`id` AS sales_person_id,
sales_person.`last_name` AS sales_person_last_name,
sales_person.`manager_id` AS sales_person_manager_id
FROM
`sales_person` sales_person
WHERE
sales_person.id in ($P!{ID})

 

i added the parameter in ireport. First i am not sure which parameter class typ i should use?! integer ?

 

I also get errors like

Cannot convert input value "[8]" of type org.apache.commons.collections.set.ListOrderedSet to a numerical parameter

TIA for any help

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

can somebody please give me a step-by-step help how i can make the IDs to a string.

I'm playing around now for more than 4 hour .... without any luck.

Where can i make the convertion ?

Can i make it in ireport or do i have to edit the xml manually ?

 

TIA

Post edited by: n0n00b, at: 2008/03/22 18:56

Link to comment
Share on other sites

  • 5 weeks later...

I solved it by creating a 2 parameters:

 

ID as java.util.Collection

ID_STR as java.lang.String

 

edit ID_STR default and add the following expression:

$P{ID}.join(",")

 

use $P{ID_STR} in your query. I was able to execute the report with and without '!'

Link to comment
Share on other sites

Correction to my last statement. You do need '!'. In my haste I wasn't thorough in my testing.

 

The '!' transposes the ID_STR string into a list of integers in the query. I'm only supposing this, but it does provide the correct results.

Post edited by: donagha, at: 2008/04/22 12:53

Link to comment
Share on other sites

  • 3 weeks later...

This join() function is'nt of java.util.Collection.

Which Class does it belong to ???

 

I tried using org.apache.commons.lang.StringUtils.join(java.util.Collections,char)

 

but this one also does'nt give the required results.

 

The required result should be...

 

e.g:

 

Code:
'str1','str2'

 

But all these examples...which you also stated, would return,

 

Code:
[code]'str1,str2'

 

This returns an empty report.

 

Post edited by: umair, at: 2008/05/07 12:59

Post edited by: umair, at: 2008/05/07 15:04

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...