Jump to content
Changes to the Jaspersoft community edition download ×

Default value Expression in parametrs of report


Recommended Posts

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();


Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...