Jump to content
Changes to the Jaspersoft community edition download ×

sum problems with CustomDataSource


2005 IR Help

Recommended Posts

By: C-Box - c-box

sum problems with CustomDataSource

2004-06-07 06:45

Hi...

 

perhaps I just have been thinking too much about it, but now I'm quite desperate/confused with my sum-variables:

 

the problem:

 

in my report I have a subreport "SR1" that contains two nested subreports ("SR1A" and "SR1B") again. All three subreports have the same datasource as it's datasource-expression. "SR1" decides at runtime for a certain fieldvalue, if the current record is shown by "SR1A" or at another certain fieldvalue by "SR1B".... just to have two different layouts for the same datasource. Therefore I use the "printwhenexpression"-tag of the subreport "SR1A" and "SR1B".

 

Now if I want a sum of a special field in the datasource (e.g. price)... but the sum-variable I have on my "SR1" is incorrect, because it sums ALL (!!) price-values and not just the values that are really shown by "SR1A" or "SR1B". There are some records more in the datasource that shall not be shown therefore I used the printwhenexpression for both nested subreports on "SR1"-level.

 

But the so called "else"-cases (records that dont match any printwhenexpression criteria of any subreport) are also in the sum-variable, although they are not printed on the whole report.

 

Has anybody an idea how to get just the sum, that is represented by the field-values that are really printed by "SR1A" and "SR1B" ????

Do I have to build up a variable for each nested subreport that sums up all records on nested-level and sum up the returnvalue at "SR1"-level??? Or is there an other more simple way?

 

tia

C-Box

 

 

 

 

By: Chuck Deal - cdeal

RE: sum problems with CustomDataSource

2004-06-07 13:31

I would say, that due to the use of the same datasource, you probably want to sum at the lowest level (the nested subreports) and have that value bubble up to the top level.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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