Jump to content

use sum of values in detail band


BatiB80

Recommended Posts

Hi,

 

I've a question which ahs been discussed here several times, but it seems that all the solutions are'nt working for me.

 

Following problem: In my detail-band I show a field named $F{customerCount}. In the summary section I sum up this field and show the sum: $V{sumCustomerCount}. That is working fine.

 

But additionally to the customerCount I want to show the percentage value of this customerCount from sum of customerCount. Therefor I added a new variable:

 

new BigDecimal($F{customerCount}.doubleValue() / $V{sumCustomerCount}.doubleValue())

 

But this isn't working somehow. It seems, that the value for the sum isn't calculated yet.

 

Does anybody knows what to do???

 

Thanks,

Sebastian

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi Lucian,

 

thanks for your answer, but this seems not to be working for me. If I directly place the sum field in my detail band and set the evaluation type to auto everything is fine. In each detail band I have the same value for sum. But I try to use the field in another varible to calculate a percentage value. In this case the sum only contains the sum of all values printed until now.

 

For example:

 

Count | Sum should be | % should be | % is

1 | 9 | 1/9 = 11% | 1/1 = 100%

3 | 9 | 3/9 = 33% | 3/4 = 75%

5 | 9 | 5/9 = 56% | 5/9 = 56%

 

I tried a lot with changing evaluation type for all fields but it isn't working...

 

Any ideas???

Post edited by: BatiB80, at: 2007/11/27 07:45

Link to comment
Share on other sites

BatiB80 wrote:

thanks for your answer, but this seems not to be working for me. If I directly place the sum field in my detail band and set the evaluation type to auto everything is fine. In each detail band I have the same value for sum. But I try to use the field in another varible to calculate a percentage value. In this case the sum only contains the sum of all values printed until now.

 

evaluationTime="Auto" only works for text fields, so if you need to compute a percentage you'll have to do it in the text field itself (like the "jasper" sample does).

 

Regards,

Lucian

Link to comment
Share on other sites

  • 10 years later...

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