Jump to content
We've recently updated our Privacy Statement, available here ×

Expression Variable


UltraByte

Recommended Posts

Hi,

I have a problem with the following expression:

 

$V{PAGE_NUMBER}+(Integer)($P{REPORT_PARAMETERS_MAP}.get("param1"))

 

it is a simple sum in an integer variable, but it gives this error

 

Code:

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class

file:
1. The operator + is undefined for the argument type (s) java.lang.Integer, java.lang.Integer
value = (java.lang.Integer)(((java.lang.Integer)variable_PAGE_NUMBER.getValue())+ (Integer)(((java.util.Map)parameter_REPORT_PARAMETERS_MAP.getValue()).get("param1")));

 

can anyone help me ?

 

thanks.

 

Post edited by: UltraByte, at: 2007/11/05 10:46

Post edited by: UltraByte, at: 2007/11/05 10:48

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

You can do this by converting Integer to BigDecimal (maybe first Integer to String, and then String to BigDecimal), and then use BigDecimal.add() method. I know this is very dirty, but it works and I don't know any other way :) You could use something like

 

(new BigDecimal($V{PAGE_NUMBER}.toString())).add(new BigDecimal($P{REPORT_PARAMETERS_MAP}.get("param1").toString()))

 

I know it's ugly.

 

Pedja

Link to comment
Share on other sites

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...