My report based in this request:
SELECT "Annee" ,"Diam", SUM("Consommation") FROM "Consom_N","CptDim" WHERE "Annee" >= $P{a1} AND "Annee" <= $P{a2} AND "Consom_N"."NumCpt"="CptDim"."NumCpt"AND "District"= $P{dst} AND $X{IN, CAST("Diam" AS CHARACTER VARYING), DiamRQn} GROUP BY "Annee","Diam" ORDER BY "Annee" ;
"Diam" field is a smallint, the problem is in this part
$X{IN, CAST("Diam" AS CHARACTER VARYING), DiamRQn}
DiamRQn is the parameter used by the control input wich is a multiple selection from request,
when remove casting it says:
PSQLException: ERROR: operator does not exist : smallint = character varying
with casting it work fine in ireport preview , but on the jasperserver, the chart shows all the values of "Diam", the selected and the not selected. As i understood,for jasperserver, casted "diam" is always exist in "DiamRQn" collection, although everything went ok for ireport !
Plz check out the attachement
Additional inf:
DBMS: postgresql
ireport ver: 5.0.1
Attachments:
2 Answers:
Posted on June 10, 2013 at 3:55am
Are you sure, that the parameter "DiamRQn</span><span style="font-family: monospace;">" </span>gets any values at all on jasperserver? Giving back all possible values is typically a problem, if the passed list is empty (in this case, the whole $X{...} clause is removed from the query...)</p>
<p>Cheers, Thomas</p>
<p>http://www.thomaszimmer.net</p>
Thank you for replying, but the class of DiamRQn is java.util.Collection, when i set It to java.util.Collection<Short> , it not working,
when cast the query of the collection
select distinct cast("Diam" as smallint) from ...
also not working
the solution mentioned in the question, work but shows all possible value of "Diam" ! and this is the problem
Thank you for replying, but the class of DiamRQn is java.util.Collection, when i set It to java.util.Collection<Short> , it not working,
when cast the query of the collection
select distinct cast("Diam" as smallint) from ...
also not working
the solution mentioned in the question, work but shows all possible value of "Diam" ! and this is the problem