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

Unknown casting problem


tanvirtonu

Recommended Posts

I have the following things in my report

 

Parameter- demo

Type-String

default value=null

 

Variable-demo1

Type-Integer

variable expression-( $P{Demo}.equals( null) ?

new Integer(0) : $V{demo1}.valueOf( $P{Demo} ) )

 

Even if I set null to parameter demo,the value of variable demo1 is shown - null instead of 0.

 

The problem is solved when I put the expression in Initial value expression of variable demo1.BUT CAN ANYBODY TELL ME WHY it is working now.And one more thing if i write $P{Demo}.equals( null),this is not recognized,but $P{Demo}== null is recognized, what is the difference?

Post edited by: tanvirtonu, at: 2008/04/16 08:33

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Initial value of a variable is the value it has when it initializes, if you have a variable that is Integer and you don't specify initial value it will be null, you can set it to new Integer(0). Variable expression is what the variable "listens to", if you set it to $F{field} and the Calculation Type is Sum, then it will sum the values of $F{field}. Experiment with it, it all depends on the use case.
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...