philipp.fresen Posted June 24, 2019 Share Posted June 24, 2019 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"> <defaultValueExpression> ![CDATA[new String("")]] </defaultValueExpression></parameter><parameter name="q_incident" class="java.lang.Integer" isForPrompting="false"> <defaultValueExpression> ![CDATA[iF($P{s_incident}.trim().length() > 0,Integer.valueOf($P{s_incident}),new java.lang.Integer(0))]] </defaultValueExpression></parameter>[/code]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 Link to comment Share on other sites More sharing options...
philipp.fresen Posted June 24, 2019 Author Share Posted June 24, 2019 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? Link to comment Share on other sites More sharing options...
Solution C-Box Posted June 24, 2019 Solution Share Posted June 24, 2019 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 + regardsC-Box Link to comment Share on other sites More sharing options...
philipp.fresen Posted June 24, 2019 Author Share Posted June 24, 2019 don't find another way to answer this...@C-BoxThanks!Worked direktly Link to comment Share on other sites More sharing options...
C-Box Posted June 24, 2019 Share Posted June 24, 2019 No problem! Nice, when it works now & I could help!regards from Dresden/GermanyC-Box 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