Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding issue with Summarys

Status
Not open for further replies.

Jimdeb03

IS-IT--Management
Dec 10, 2002
89
0
0
US
I have an issue with rounding that I need some assistance.
Let's say a typical report has many groups populated by a stored procedure from a database.

Each group has a its own summary field of a database field
Something like this
Code:
-GH1		Groupby TrackID
--GH2
----GH3
-----Detail	database field {uspSELECT;1.HostFee}
----GF3    Summary Sum of {uspSELECT;1.HostFee}
--GF2  Summary Sum of {uspSELECT;1.HostFee}
-GF1 Summary Sum of {uspSELECT;1.HostFee}		
RF Summary Sum of {uspSELECT;1.HostFee}

The report has two summaries for GF1 because of 2 TrackId's
37.224
3.564
These sum via the Summary in RF to...
40.788

However, if we display the above fields to only 2 decimals like..
37.22
3.56
Summary RF is...
40.79

It should be 40.78
Obviously 40.788 rounds to 40.79 but visually, 37.22 + 3.56 = 40.78.

How can this be accomplished?

I understand each subsequent summary sums the database field, in this case HostFee.
Database field uspSELECT;1.HostFee datatype is decimal(10,3)

How do I make Summary RF display as 40.78 instead of 40.79? Changing the decimal formatting from 1.000 to 1.00 and it
rounds up when I don't want it to.

Is there a way to display decimal 1.00 and not have it round up? Editing Rounding formatting doesn't help.
 
You could sum the rounded values, as in:

whileprintingrecords;
numbervar sumx := sumx + round(sum({uspSELECT;1.HostFee},{table.group#1field}),2);

Then in the report footer use:

whileprintingrecords;
numbervar sumx;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top