johann60280 Posted December 29, 2016 Share Posted December 29, 2016 I have a problem with my parameter who are an input control in Ireport. My parameter is a boolean. And I try to set a default value because I need to modify my sql request with parameter. By example if my parameter is true so I put on my request a like with an other parameters else I put nothing. But my problem is my parameters is always true or false and not the value I define in default value.This is my try with default value of my parameter:$P{choix_repere_depart}=="true"? " AND d.cellule like '%$P{mot_cle}%'": " "[/code]And this my sql request:SELECT r.designation as designation, l.nom as nom, e.gare as gare, b.intitule as intitule, a.code_mire as code_mire, af.codegmao as codegmaoAF, ap.codegmao as codegmaoAP, d.cellule as repere, d.observation as observation, m.appareil as appareilFROM armoireprincipale apLEFT JOIN armoire a ON a.idbranchement = ap.idbranchementLEFT JOIN armoirefille af ON af.idbranchement = a.idbranchementLEFT JOIN branchement b ON b.idbranchement = a.idbranchementLEFT JOIN ligne l ON l.id_ligne = b.id_ligneLEFT JOIN reseau r ON r.id_reseau = l.id_reseauLEFT JOIN edifice e ON e.indic = b.indicLEFT JOIN depart d ON d.idbranchement = a.idbranchementLEFT JOIN materiel m ON m.id_materiel = d.id_materielWHERE a.idbranchement IN (SELECT b.idbranchement FROM branchement b0 LEFT JOIN cable c ON c.idbranchement = b0.idbranchement LEFT JOIN cable_depart cb ON cb.id = c.id LEFT JOIN depart d0 ON d0.iddepart = cb.iddepart LEFT JOIN armoire a0 ON a0.idbranchement = d0.idbranchement LEFT JOIN armoireprincipale ap0 ON ap0.idbranchement = a0.idbranchement WHERE ap0.ug_pef= $P{id_pef}) $P{choix_repere_depart};[/code]So I need help to understand what is wrong on my report. If someone has an idea please help me!!! Thank!! Link to comment Share on other sites More sharing options...
hozawa Posted December 30, 2016 Share Posted December 30, 2016 JasperReports don't support nested parameters. Instead of nesting parts of a sql command, try setting the true and false condition each to an entire sql command and use $P! Link to comment Share on other sites More sharing options...
johann60280 Posted December 30, 2016 Author Share Posted December 30, 2016 Have you an example to give me for my case ? 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