Operador IN sql - como usar com variável[RESOLVIDO]

Boa noite, estou tentando fazer o seguinte select no IREPORT

porém não funciona, alguem sabe como fazer? to querendo passar a List por parâmetro… tem como?

valeu

Tem sim, porem precisa usar uma sintaxe diferente., procura no manual que vc acha. Nao lembro exatamente agora, talvez amnh no servico.
Abrc

Valeu cara, vou procurar, caso vc ache favor posta aki.

abraço

Assim deu certo: SELECT * FROM ELEITORES WHERE ID_ELEITOR IN ($P!{ids})
apenas colocando um ! entro o $P e o {ids}

valeu

Essa forma na epoca nao funcionou pra mim, vc deve estar passando outro tipo d lista que nao é um java.util.List.
Resolvi da seguinte forma, olha o trecho do manual:

JasperReports provides a special syntax to use with a where condition: the clause IN and NOT IN.
The clause is used to check whether a particular value is present in a discrete set of values. Here is an example:
SELECT * FROM ORDERS WHERE SHIPCOUNTRY IS IN (‘USA’,‘Italy’,‘Germany’)
The set here is defined by the countries USA, Italy and Germany. Assuming we are passing the set of countries in a list (or
better a java.util.Collection) or in an array, the syntax to make the previous query dynamic in reference to the set of
countries is:
SELECT * FROM ORDERS WHERE $X{IN, SHIPCOUNTRY, myCountries}
where myCountries is the name of the parameter that contains the set of country names. The $X{} clause recognizes three
parameters:

  • Type of function to apply (IN or NOT IN)
  • Field name to be evaluated
  • Parameter name
    JasperReports will handle special characters in each value. If the parameter is null or contains an empty list, meaning no
    value has been set for the parameter, the entire $X{} clause is evaluated as the always true statement ?0 = 0?.