sgarciaf Posted May 20, 2010 Share Posted May 20, 2010 Hi,I have a query that returns something like:Help Year num1 1 122 1 353 1 464 1 31 2 232 2 673 2 394 2 171 3 372 3 653 3 114 3 54 I want to make a chart showing: num_help1_year1/sum(num_year1), num_help2_year1/sum(num_year1), ......num_help1_year4/sum(num_year4), num_help2_year4/sum(num_year4)... But idk how to make a sum and a division... an also idk how to make the sum for each year.Anyone can help me? I'm using iReport 3.7.2.Sorry, I'm spanish and my english is not really good.Post Edited by sgarciaf at 05/20/2010 10:57 Link to comment Share on other sites More sharing options...
slow Posted May 21, 2010 Share Posted May 21, 2010 for the sum try to study variables (calculation type: SUM)...for division the syntax changes if you use Integer or BidDecimal or ... the types that you use to represent the fields from your DB.try to be more clear in the question... a very simple way is:$F{aFieldName_A}.intValue() / $F{aFieldName_B}.intValue() Link to comment Share on other sites More sharing options...
sgarciaf Posted May 21, 2010 Author Share Posted May 21, 2010 Thanks slow,My variables are Long type. Link to comment Share on other sites More sharing options...
slow Posted May 21, 2010 Share Posted May 21, 2010 Long class doesn't have method to perform division... so you can use primitive values:$F{fieldName_A}.intValue() / $F{fieldName_B}.intValue()or$F{fieldName_A}.longValue() / $F{fieldName_B}.longValue() 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