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

Group footer calculation


Recommended Posts

By: Martin Phee - mphee

Group footer calculation

2002-11-06 08:05

I have two groups on a report. The first group is an overall group for the report (pipeline). The second group will always have two breaks (receipts and deliveries).

 

I want the pipeline group footer to show the difference between the receipts and dliveries breaks. All numbers are positive and it would be: receipts - deliveries. I can probably do it in the sql, but I'd like to know of a way to do it in Jasper. Basically, referencing the two group breaks.

 

 

 

 

 

By: Teodor Danciu - teodord

RE: Group footer calculation

2002-11-06 13:19

 

Hi,

 

Have you tried any trick using scriptlets?

 

I hope this helps.

Teodor

 

 

 

By: Martin Phee - mphee

RE: Group footer calculation

2002-11-07 07:27

I'm trying to do that now, but I'm running into a problem.

 

Everytime the program comes into afterDetailEval my report variable "SumNSV1" is null. I've been trying to use it as a running sum, and reseting it in beforeGroupInit but it's not holding it's value between calls to afterDetailEval.

 

The variable resetType="Report". I've also tried None. Neither has worked. I've set the varible expression to

<variableExpression/>

 

I stepped through the code of getVariableValue. I noticed that my var's oldValue is holding my previous value that I set.

 

Why is it getting reset?

 

 

By: Martin Phee - mphee

RE: Group footer calculation

2002-11-07 07:50

I think I found the problem.

 

Looks like it's in Calculator.calculateVariables(). It's being call from fillDetail in JRVerticalFiller. Everytime it does the calculateVariables it resets my varible to null.

 

 

By: Teodor Danciu - teodord

RE: Group footer calculation

2002-11-07 13:24

 

Hi,

 

You need to set calculation="System" for the

variables that you want to calculate yourself

in scriptlets.

 

This is explained in the "ultimate guide".

 

Thank you,

Teodor

 

 

 

By: Martin Phee - mphee

RE: Group footer calculation

2002-11-07 14:11

Still isn't working.

 

<variable name="sumnsv1" class="java.lang.Float" resetType="None" calculation="System">

<variableExpression/>

</variable>

 

Every time is hits afterDetailEval it is null.

 

I couldn't see anything in the code that would stop it from getting reinitialized.

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