Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Please Help! Rounding/data issue Post Reply Post New Topic
Author Message
crystal_dummy
Newbie
Newbie
Avatar

Joined: 14 May 2008
Location: United States
Online Status: Offline
Posts: 3
Quote crystal_dummy Replybullet Topic: Please Help! Rounding/data issue
     Posted: 14 May 2008 at 1:39pm

So, I've hit a glitch that I can't figure out and I've spent many hours and asked many knowledgeable systems experts.  My report is pulling from a csv file.  The data adds up to -3,889.83 but the value the report is pulling is -3,888.00

Why is it doing this.  It's not even correctly rounding, so I can't understand where this number is coming from.  I have checked the data numerous times and it adds up to the correct number, why won't the report pull the correct number?  I've checked the number formatting, etc.  It just doesn't make sense to me. 
 
Does anyone know what is going on here?  ANy help is very much appreciated!!  Thanks in advance!
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 15 May 2008 at 5:25am
My guess would be that it is rounding each number to the nearest integer as it reads it into Crystal, and then summing them.  You just happen to have a preponderance of data that rounds down, moving the sum towards 0.

A few things I would check:

What is the localized symbol for the decimal point?  Keep in mind that in Europe, they use the comma for the decimal point.  In a CSV file, this can cause some obvious issues.

Do you have field stripping enabled for numbers in Crystal?  This would be in the number format dialog.  I don't think that should affect this particular operation, but it could.

Is everything in the operation set to accept the number as a decimal (or float or double or whatnot)?  Something along the line may be interpreting the numbers as integers.

Do you perform any manipulation of the numbers other than summing them?


IP IP Logged
crystal_dummy
Newbie
Newbie
Avatar

Joined: 14 May 2008
Location: United States
Online Status: Offline
Posts: 3
Quote crystal_dummy Replybullet Posted: 19 May 2008 at 12:29pm
Yes, you are corect, it is rounding the number to the nearest integer, then summing them.  I just don't know why its doing that.  It is only doing this for the one field.  All other fields are working fine (not rounding.) 
 
the symbol for the decimal point is "."  Field stripping is not enabled.   And everything is set to accept the number as a decimal.   The only thing the report should be doing is summing the numbers in the data file (without rounding to nearest integer.) So I'm really not sure what the issue is. 
IP IP Logged
crystal_dummy
Newbie
Newbie
Avatar

Joined: 14 May 2008
Location: United States
Online Status: Offline
Posts: 3
Quote crystal_dummy Replybullet Posted: 19 May 2008 at 12:29pm
Yes, you are correct, it is rounding the number to the nearest integer, then summing them.  I just don't know why its doing that.  It is only doing this for the one field.  All other fields are working fine (not rounding.) 
 
the symbol for the decimal point is "."  Field stripping is not enabled.   And everything is set to accept the number as a decimal.   The only thing the report should be doing is summing the numbers in the data file (without rounding to nearest integer.) So I'm really not sure what the issue is. 
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 20 May 2008 at 5:12am
Unfortunately, I seriously doubt my ability to troubleshoot the problem from here.  But, I'll give you some possible tactics.

Open the CSV file in Excel (or equivalent program).  Do the amounts still show up as decimals?  Do they sum correctly?

Create a new Crystal report that just displays the contents of the CSV file, with no formatting or summing.  Do the amounts show up as decimals?  If so, add a summary to the report footer.  Does it sum correctly?

Does the first amount in the CSV file have a decimal?  Some programs have a tendency to guess at the appropriate number type based on the first value.  I know that Excel and SQL Server do this a lot.  If it is a whole number, you might try just adding a decimal with trailing zeroes to it (e.g., change 234 to 234.00).


IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum