Error evaluating expression for Integer.valueOf($P{string})


hey folks,

i get an evaluation error for parsing a string to an int with "Integer.valueOf(<string-param>)".

<parameter name="s_incident" class="java.lang.String" isForPrompting="false">
        ![CDATA[new String("")]]
<parameter name="q_incident" class="java.lang.Integer" isForPrompting="false">
        ![CDATA[IF($P{s_incident}.trim().length() > 0,Integer.valueOf($P{s_incident}),new java.lang.Integer(0))]]

the string parameter is used as input control in the JasperReporting Server (i want the field to be blank at the beginning).

the int parameter is used in the sql query.

Hope someone can help me..

best regards, Philipp

philipp.fresen's picture
Joined: May 8 2019 - 7:25am
Last seen: 1 year 10 months ago

The problem is based on the empty default value of the string parameter.

does anyone know how the default value for an integer is in Jasper?

philipp.fresen - 1 year 11 months ago

don't find another way to answer this...



Worked direktly

philipp.fresen - 1 year 11 months ago

No problem! Nice, when it works now & I could help!

regards from Dresden/Germany


C-Box - 1 year 11 months ago

1 Answer:


I would use following as Default Expression for your Integer Parameter:

$P{s_incident} == null || "".equals($P{s_incident}.trim())? new Integer(0) : Integer.valueOf($P{s_incident})

hth + regards


C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 week 6 days ago