How to use array list in jasperreport Studio

0

Guys, I need your help, I need my query to get a list of values of type integer, to compare in an in;

idcargo_group in ($P{parameterList})
idcargo_group in (1,2,3,4,5)

I need to pass the list this way.

For the list I used the type of list I used the class java.util.List and for the Nested Type Name java.lang.Integer.

henrique.santos1988's picture
Joined: Jan 9 2018 - 8:26am
Last seen: 9 months 1 week ago

3 Answers:

0

Use $X{IN, FIELD_NAME, LIST_VALUES}

Mariano

mlopez_1's picture
909
Joined: Oct 21 2013 - 8:08am
Last seen: 3 days 8 hours ago
1

Hi Henrique,

For obtaining the desired result you will have to set the type of the prameter as a collection (java.util.collection) 

And the expression replacing in the query equivalent to your requirment

idcargo_group in ($P{parameterList})
idcargo_group in (1,2,3,4,5)

 

would be - 

$X{IN, name of table column, idcargo_group(name of the collection parameter)}

Let me know if this helps.

 

Thanks

Ankur Gupta

Ankur Gupta's picture
Joined: Jan 21 2013 - 10:36pm
Last seen: 1 year 1 month ago
0

Helped yes, but I still can not solve my problem, I have put this way:

$X{IN, fuc.idcargo, $P{idcargo}};

defined $P{idcargo} as of type java.util.Collection

but that would be '$X', it was not clear to me, and I still get this error message

[Internal Exception: org.postgresql.util.PSQLException: Can not infer the SQL type to use for an instance of java.util .ArrayList. Use setObject () with an explicit Types value to specify the type to use.].  

I need a lot of help, thanks in advance.
 

henrique.santos1988's picture
Joined: Jan 9 2018 - 8:26am
Last seen: 9 months 1 week ago
Feedback