mikesolomon Posted April 24, 2008 Share Posted April 24, 2008 Is it possible to create calculated fields in Ireport? I have an sql statement that returns name num1 num2 num3 What I want is to be able to add num1 to num2 and divide it by num3 Then do the same in the total I would have thought this should be really easy but I can't see how to do it Any help would be much appreciated Link to comment Share on other sites More sharing options...
Pedja Posted April 24, 2008 Share Posted April 24, 2008 What are the types of the num1, num2 and num3? If it is BigDecimal, you can set your field to java.lang.Float, and set the expression to ($F{num1}.floatValue() + $F{num2}.floatValue())/$F{num3}.floatValue() Link to comment Share on other sites More sharing options...
mikesolomon Posted April 24, 2008 Author Share Posted April 24, 2008 Thanks - thats exactly what I wanted I presume I create a variable and put the expression there Link to comment Share on other sites More sharing options...
Pedja Posted April 24, 2008 Share Posted April 24, 2008 You can put it directly in Text Field Expression, or you can make a variable, it depends on what you need. 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