vk01 Posted October 27, 2007 Share Posted October 27, 2007 Hi, Does this division work only for the integers? I need to use "division" for two BigDecimal values. Thanks! Link to comment Share on other sites More sharing options...
bklawans Posted October 27, 2007 Share Posted October 27, 2007 When using BigDecimals you need to use the mathematical operators defined in the BigDecimal class. So if you need to divide two BigDecimals create an expression of type BigDecimal and use "bigDecimalOne.divide(bigDecimalTwo, BigDecimal.ROUND_HALF_UP)", which gives you the result of a your variable bigDecimalOne divided by the variable BigDecimalTwo. -Barry Link to comment Share on other sites More sharing options...
mfa Posted October 30, 2007 Share Posted October 30, 2007 hi mster sir i use oracle with ireport but when i use variable for group total this is my table field $F{UNICON} i check the type that give me BigDecimal i change with integer and that variable i use $V{mfatt} type is integerbut when i compile that give me error it.businesslogic.ireport.gui.logpane.ProblemItem@f0f875 Cannot cast from BigDecimal to Integer Line 48, Column 23 /jasperReport/variable [1]/variableExpression[1] please give me idea how i get field fotal and how i change BigDecimal with integer and where i write code thank's aamir Link to comment Share on other sites More sharing options...
bklawans Posted November 9, 2007 Share Posted November 9, 2007 You can get the value of a BigDecimal as an integer by calling intValue() on it, and then create an Integer from that. Be careful though - if iReport thinks the returned value is a BigDecimal, that probably means that the field is declared in the database to be large enough to overflow an integer. -Barry 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