Jump to content
JasperReports Library 7.0 is now available ×

Variable returns null/blank at first row in report


alfie1109
Go to solution Solved by alfie1109,

Recommended Posts

Hi All-

I have variables that does some calculation

First Variable:  Adds all Discounts (Discounts Column)

Name:  Discounts_Total
Variable Class:  java.lang.float
Calculation:  SUM
Reset Type:  Group
Reset Group:  Group ID
Increment Type:  None
Increment Group:  blank
Variable Expression:  Float.parseFloat($F{Discounts})
Initial Value Expression:  0

Second Variable:  Return the Highest Total for each Group ID (Discounts Column)

Name:  Discount_TotalGrp
Variable Class:  java.lang.float
Calculation:  Highest
Reset Type:  Report
Reset Group:  blank
Imcrement Type:  Page
Increment Group:  blank
Variable Expression:  $V{Discounts_Total}

The Result:  First row is blank, it should be $119.95 first and then so on and so on.......

IDNAMEDISCOUNTS
1FOOD[blank, should be 119.95 here and then so on... so on...]
2FOOD SPCL119.95
3BEVERAGES0.00
4LIQUOR2.20
5BEER BTL15.30
6BEER SPCL2.50
7WINE0.00
8BEER DRAFT0.00
TOTAL 139.95


Any ideas on why the value returns to the second row instead of first row?  

Thanks!

~a

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

I set the following variables in order and set each variable (see below)

Name = Discounts_Total
Variable Class = java.lang.float
Calculation = Sum
Reset Type = Group
Reset Group = Group ID
Increment Type = None
Increment Group = 
Variable Expression = Float.parseFloat($F{Discounts})

 

Name = Dsct_TotalGrp
Variable Class = java.lang.float
Calculation = Highest
Reset Type = Group
Reset Group = Group ID
Increment Type = Group
Increment Group = Group ID
Variable Expression = $V{Discounts_Total}

On the text field properties:

Text Field Expression:  $V{Dsct_TotalGrp}

Change Evaluation Time and Group

Evaluation Time =    Group
Evaluation Group =  Group ID

After I made the following changes, report works!!!!!
 

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