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
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
7 Answers:
Posted on November 27, 2007 at 7:44am
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
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
Posted on November 27, 2007 at 8:03am
I created two pdf-reports. Please see attachement [file name=sample1.pdf size=1506]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/sam...
Posted on November 27, 2007 at 8:03am
and the second one... [file name=sample2.pdf size=1510]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/sam...
Posted on November 27, 2007 at 10:44am
BatiB80 wrote:
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
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