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

How to display floating point numbers on report? 1

Status
Not open for further replies.

GabeD

Programmer
Dec 2, 2010
4
US
I'm new to Crystal Reports and hoping that someone can answer my question: In Crystal Reports XI, I want to display 1.10 as 1.1, 1.00 as 1, 1.01 as 1.01, -1.00 as -1, -10.00 as -10, etc. on the report. How do I do this in Crystal? I cannot find an option for it. Thanks.
 
Right click on the field you want to formula->format field->number->customize->decimal->x+2 and enter:

numbervar dec := 9;//set the maximum number of decimals here
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

In rounding (just below) go to the x+2 formula area and enter:

numbervar dec;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top