mpeshkov Posted November 29, 2006 Share Posted November 29, 2006 Hi, How to solve a problem?: I have the template (jrxml file), which was created in iReport. There is parametr "Version"(java.lang.String, is not ForPrompting and default value expression:"version 1.0.2") When I fill this report from my program i get error: net.sf.jasperreports.engine.JRException: Incompatible net.sf.jasperreports.engine.base.JRBaseParameter value assigned to parameter Version (If set this parametr:parameters.put("Version","test"); - All ok) How right to pass parametr with default value??? My code: JasperReport jasperReport = (JasperReport) JRLoader.loadObject(filename));JRParameter[] jrParam = jasperReport.getParameters();Map parameters = new HashMap();parameters.put("customerId",new Long("233301"); for (int i = 0; i < jrParam.length; i++) if (!jrParam.isForPrompting()) if (jrParam.getValueClassName().equals("java.lang.String"))parameters.put(jrParam.getName(), (Object) jrParam); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, connection)); JasperExportManager exp = new JasperExportManager();exp.exportReportToPdfFile(jasperPrint,path); Link to comment Share on other sites More sharing options...
teodord Posted December 12, 2006 Share Posted December 12, 2006 Hi, If the parameter is declared of type String, why do you put a jrParam instance in the map???You should put a String value there. Otherwise, you could simply not put anything and the default value will be used by the engine. I hope this helps.Teodor 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