dunham Posted June 5, 2019 Share Posted June 5, 2019 How do I read a boolean value from Report_Parameters_map? ( $P{REPORT_PARAMETERS_MAP}.get("booleanParam") == true ? "mifid JAA" : "mifid NEIN") (For numbers I can simply do .valueOf(), but there seems to be no equivalent solution for booleans) ...When I run the following code there is an error:( $P{REPORT_PARAMETERS_MAP}.get("booleanParam") == true ? "mifid JAA" : "mifid NEIN") -> Throws errorException: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:1. The method booleanValue(String) is undefined for the type Map ((java.util.Map)parameter_REPORT_PARAMETERS_MAP.getValue()).booleanValue("isMiFIDReport") == true ? "mifid JAA" : "mifid NEIN" //$JR_EXPR_ID=84$ <---------->2. The method booleanValue(String) is undefined for the type Map ((java.util.Map)parameter_REPORT_PARAMETERS_MAP.getValue()).booleanValue("isMiFIDReport") == true ? "mifid JAA" : "mifid NEIN" //$JR_EXPR_ID=84$ <---------->3. The method booleanValue(String) is undefined for the type Map ((java.util.Map)parameter_REPORT_PARAMETERS_MAP.getValue()).booleanValue("isMiFIDReport") == true ? "mifid JAA" : "mifid NEIN" //$JR_EXPR_ID=84$ <---------->3 errors.stack: [net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:206), net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:357), net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:343), net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:608), dynamicreports.Rep3.makeReport(Rep3.java:2494), dynamicreports.Rep3.main(Rep3.java:3558)] Link to comment Share on other sites More sharing options...
C-Box Posted June 5, 2019 Share Posted June 5, 2019 have you already tried: Boolean.TRUE.equals($P{REPORT_PARAMETERS_MAP}.get("YourBooleanParameterName"))[/code]that should be null-safe and IMHO works.hth + regardsC-Box Link to comment Share on other sites More sharing options...
dunham Posted June 6, 2019 Author Share Posted June 6, 2019 Hi. That did work indeed. Thank you!Here is the final code snippet:( Boolean.TRUE.equals($P{REPORT_PARAMETERS_MAP}.get("booleanParameter")) ? "is true" : "is false")[/code] 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