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

Sum and division expression


sgarciaf

Recommended Posts

Hi,

I have a query that returns something like:

Help      Year     num

1               1           12

2               1           35

3               1           46

4               1           3

1               2           23

2               2           67

3               2           39

4               2           17

1               3           37

2               3          65

3               3           11

4               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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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

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...