Jump to content
Changes to the Jaspersoft community edition download ×

summing subreport return values on mainreport


jpyeo

Recommended Posts

I've done a report consisiting of 6 subreports in which the subreports have a total.

I manage to get the subtotals to display in the main report by passing them through variables but i'm having problems adding them up.

 

what i did in the main report is :

1. Create a variable type double called TOTAL_COMMISSION

2. In the expression of (1)

 

new Double($P{A}.doublevalue() + $P{B}.doublevalue() + $P{C}.doublevalue() + $P{D}.doublevalue()+ $P{E}.doublevalue())

 

3. Place the variable in the summary band (tried all other bands as well!) and set the evaluation time to 'report' (as well as all other possible options!).

 

The value of TOTAL_COMMISION always return 'null' eventhough all the variables are not null.

 

Someone please enlighten on this issue. Really would aprreciate it.

 

Thanks again!

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

Could you post a sample here which can reproduce the problem? It will make things more explicit.

Until then, I just can tell you that doublevalue() is undefined for the Double class (use doubleValue() instead). Also you were talking about variables, but your notations were parameter-like, not variable-like.

How did you tested your 5 variables against null?

 

hth,

sanda

Link to comment
Share on other sites

shertage, thx for the reply. please view the attachment jxrml file. On the top right are values of subreport passed on to the main report. At the bottom right, the total commision is the summation of all the variables passed from the subreports. which is returning null. [file name=Commision_Statement_MthYear.pdf size=7993]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/Commision_Statement_MthYear.pdf[/file]

Post edited by: jpyeo, at: 2007/08/09 01:55

Link to comment
Share on other sites

Hi,

 

I think it would be better if you don't use the intermediate TOTAL_COMMISSION variable. Just write in your textfield expression new Double(2*($V{SUB_OVERRIDING}.doubleValue())) instead of $V{TOTAL_COMMISSION}. Doing so you keep staying bound to the SUB_OVERRIDING variable.

 

hth,

sanda

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