dewie Posted July 4, 2007 Share Posted July 4, 2007 Hi, I'm using ireport to generate some reports for a new project i'm doing. I build a jetty jruby interface so i can use these reports in ruby on rails. I would like to do some calculations in ireport ( i now use a xml datasource and do the calculations in ruby on rails) The problem is i can't do a simple calculation like the following : F{field_price} * $F{quantity} I get all sort of java errors, i tried google for a basic instruction in calculating in java , but no joy. Can someone put me in a right way by some examples of calculating in ireport, or to a java tutorial i can use ? Kind regards daniel Link to comment Share on other sites More sharing options...
megotronx Posted July 4, 2007 Share Posted July 4, 2007 hi dewie! try this: new java.lang.Integer( ($F{field_price}.intValue()) *($F{quantity}.intValue()) ) Link to comment Share on other sites More sharing options...
dewie Posted July 4, 2007 Author Share Posted July 4, 2007 What if i need doubles ? quantity is not always a integer , for example 12.45 Link to comment Share on other sites More sharing options...
megotronx Posted July 4, 2007 Share Posted July 4, 2007 then try this: new java.lang.Double( ($F{field_price}.doubleValue()) *($F{quantity}.doubleValue()) ) Link to comment Share on other sites More sharing options...
dewie Posted July 4, 2007 Author Share Posted July 4, 2007 Thanks ! that does the trick, any good link where i can find this sort of java information ? Link to comment Share on other sites More sharing options...
svenn Posted July 4, 2007 Share Posted July 4, 2007 The best link is the Java API. This is the one for 5 but you can also find ones for earler versions. http://java.sun.com/j2se/1.5.0/docs/api/ 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