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

Do NOT format numbers in Crystal Reports 9 2

Status
Not open for further replies.

cummina

Programmer
Feb 25, 2005
7
0
0
US
Hi there-

I feel like I'm missing something simple here...

I can't get my reports to display a number exactly as it's entered in my database, e.g. I may have entered the number 1209, but Crystal displays 1,209.00.

I'm using Crystal Reports 9 and SQL Server. I've confirmed that SQL Server is not changing the number.

I work in a laboratory, so I need these numbers to display on the report exactly as they're entered in the database. I can't set number formatting because the number of decimal places or significant figures varies depending on the analysis - I can't just say that all of our results will have two decimal places and that's it.

Any help would be much appreciated.

Thanks-
Anne
 
Hi,

Try thses steps to format the field.

right click while on the field.
click on "format field"
hightlight the "custom style" in the list (i think it will default to the "custome style")
click on "customize"
change the decimals setting by removing (deleting) the decimal from the box.
do the same for the thousands seperator.

While on that screen it is a good idea to uncheck the field to allow field clipping. That way if part of the number is not displaying because the field is not stretched far enough, you can tell because pound signs, ### print instead.
click ok.
save your changes.

 
I repied really quick an now I see I probably didn't help you at all.

Sorry.
 
Go to format field->number->customize->rounding and choose the maximum number of decimals, which appears to be: .0000000001, and then go to decimals ->x+2 and enter:

numbervar dec := 9;
numbervar i;
numbervar j := dec + 1;
numbervar x;

for i := 1 to j do (
if val(right(totext(currentfieldvalue,j,""),i)) = 0 then
x := j - i);
x

This would format up to 9 decimals, removing zeros at the end. If you have numbers with more than 9 decimals, though, rounding will occur and the above formula will also start rounding to fewer decimals.

If this meets your needs (I would test it thoroughly first), you could set the rounding and use this formula in the conditional formula area for decimals in file->options->field->number->customize->decimal->x+2, instead of using it on each individual field.

-LB
 
LB,

That worked exactly right. You deserve a star. :)

Thanks so much!
Anne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top