d.taillade Posted December 15, 2016 Share Posted December 15, 2016 Hello,I need to mix parameter $P and $P! in query to do a single report. But I don't manage, I have an errror in query.I have a first parameter "WITH_NUMFACT" and according to it I do :if 1 then numfact = param_numfactelse tri = param_tri and another substitutionHere the query parameter (Q_WITH_NUMFACT) :($P{WITH_NUMFACT} == 1) ? " AND FACTUR_MAITRE.NUMFACT = $P{NUMFACT} " : " AND FACTUR_MAITRE.FLAG_TRI >= nvl( $P{TRI} ,1) $P!{Q_IN_NOTIN}"[/code]And in my query I do :SELECT my_columns FROM my_table WHERE 1=1 $P!{Q_WITH_NUMFACT}[/code]If I show the parameter Q_WITH_NUMFACT, the result is : AND FACTUR_MAITRE.FLAG_TRI >= ((java.lang.Integer)parameter_TRI.getValue()),1)$P!{Q_IN_NOTIN}[/code]The system doesn't translate the parameters.How do it ?Many thanks in advance for your help !! Link to comment Share on other sites More sharing options...
Solution hozawa Posted December 15, 2016 Solution Share Posted December 15, 2016 JasperReports doesn't support nested parameters. You can try using nested conditionals.I just usually create JRDataSource in my program and then just passed that to instead of creating complex SQL statements in my report. Link to comment Share on other sites More sharing options...
d.taillade Posted December 15, 2016 Author Share Posted December 15, 2016 Thanks for your answer !So I'll try with nested conditionals. Link to comment Share on other sites More sharing options...
lucianc Posted December 16, 2016 Share Posted December 16, 2016 What you need to do is to escape $P{..} with $$P{..} in the Q_WITH_NUMFACT expression so that they are interpreted literally:($P{WITH_NUMFACT} == 1) ? " AND FACTUR_MAITRE.NUMFACT = $$P{NUMFACT} " : " AND FACTUR_MAITRE.FLAG_TRI >= nvl( $$P{TRI} ,1) $P!{Q_IN_NOTIN}"[/code]Regards,Lucian 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