jmaguilar Posted November 10, 2006 Share Posted November 10, 2006 Hi all, I've got a problem with one report. I'm using HQL in the query and I need to pass and expresion in WHERE block (i.e. FROM mypackage.MyClass as object WHERE ( $P{expresion} ) and $P{expresion} could be, "object.property = 1 OR object.property = 4" ,however when I try perform this I received the exception [10 nov 2006 10:53:54,343][ERROR] [org.hibernate.hql.PARSER (reportError)] <AST>:12:9: unexpected AST node: : The query is : [sELECT bs.id.codEstudio as codEstudio, bs.id.fechaRecepcion as fechaRecepcion, bs.id.hisClinica as hisClinica, bs.id.edad as edad, bs.id.fotosMacro as fotosMacro, bs.id.fotosMicro as fotosMicro, bs.id.casoInteresante as casoInteresante, bs.id.codSnomed as codSnomed, bs.id.snomed as snomed, bs.id.nombre as pacienteNombre, bs.id.apellido1 as pacienteApellido1, bs.id.apellido2 as pacienteApellido2, bs.id.sexo as sexoFROM es.ingenia.infopat.modelo.informes.vistas.VdbInformesBusquedaSnomeds bsWHERE (bs.id.tipoEstudio = :_tipoEstudio OR :_tipoEstudio = '') AND (bs.id.sexo = :_sexo OR :_sexo = '') AND (bs.id.casoInteresante = :_casoInteresante) AND ( (bs.id.fotosMacro > 0 AND :_fotosMacro = true) OR :_fotosMacro = false ) AND ( (bs.id.fotosMicro > 0 AND :_fotosMicro = true) OR :_fotosMicro = false ) AND (bs.id.fechaRecepcion BETWEEN :_fechaInicio AND :_fechaFin) AND (bs.id.edad BETWEEN :_edadInicio AND :_edadFin) AND ( :_expresion )] the fail is in the last parameter :_expresion, it seems that jasper parses the "prepare" query before exchange parameter names by parameter values. Any idea about this issue? Thanks in advance. Best regards, Justo Aguilar. -------------------------------------------------------------------You could make a fast and easy example with a query like this: FROM AnyOfYourClassesWHERE ( $P{expression} ) where $P{expresion} could be 1 = 1------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
lucianc Posted November 10, 2006 Share Posted November 10, 2006 Use WHERE ( $P!{expresion} ) HTH,Lucian Link to comment Share on other sites More sharing options...
jmaguilar Posted November 10, 2006 Author Share Posted November 10, 2006 That solved my problem. Thanks a lot, Lucian. Best regards, Justo Aguilar. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now