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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numerical Field Output 1

Status
Not open for further replies.

sfujii

Programmer
Nov 28, 2005
4
US
Hi,

I have a field which is typically contains a number
xyz.abcd

Running my crystal report, if "d" was 5 or higher, the number was rounded up. If "d" was 4 or lower, "d" takes on the value of zero. This seems to be a problem with how big the number is. The field itself has "single" as a data type. If I create a value of yz.abcd or xyz.abc, the field shows up as is. The above behavior only shows up when I have three digits to the left of the decimal and four digits to the right. Could anyone tell me what's going on and how I can fix it? I tried the totext(field,4,"") formula but it did not get rid of the above behavior. CStr(field) only gave me a number with 2 decimal places.

TIA!
 
Try posting technical information:

Crystal version
Database/connectivity used
Example data (you show xyz.abc????...)
Expected output

I'm not sure why you wanted to convert it to text anyway, that can cause problems itself.

Anyway, the precision is what you make it. Rather than using the formula I supplied you in your other post, try just placing the field in the column and right clicking it and selecting format field and set the decimals, rounding, etc. to whatever you'd like.

Then create another formula and place it over the top of it of:

if {table.field} = "" then
"N/A" //or whatever you want

Then conditionally suppress each based on the value.

A tad mroe work, but it allows for a good deal more flexibility.

-k
 
Sorry

I'm using CR .NET and an access database.

In my program, if I type in 99.9999, 149.999, 99.9993, the output in crystal reports are those numbers.
If I type in 149.9999 or 149.9993, I get 150 or 149.9990 respectively. I had just plugged in the field into my crystal report, right clicked, set decimal places to 4 and rounding to 0.0001 and still got the behavior above. I couldn't understand why I was getting what I got.

TIA!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top