Question

How to format a decimal number in Crystal

Rating9.3Excellent

I would like to format a number depending on whether it is a whole number or not.
e.g.
IF 'my_number' INCLUDES '.' THEN display 'my_number' to 1 decimal place
ELSE IF 'my_number' IS a whole number then display as a whole number.

So, if the value in the database is '5' then I want it to display as '5' on the report. If the value in the database is '4.6' then I want it to display as '4.6'.

The problem is that if I set the report to use the whole number then the 4.6 would round up to 5. In order to get the report to display 4.6 I need to set it to use 1 decimal place - this in turn would mean that a number of 5 would show as 5.0 on the report rather than 5.

Anyone know how I can get around this or what I am doing wrong?
(Using Version 11)

See More

Solution

Access this solution immediately by signing up as a member of CrystalReportsExperts.com--it’s quick, easy, and secure. We will return you to this solution, unlocked, when you’re done.

About this Solution

Sign up Now to View This Solution
Zone
general
Tags
Crystal Reports
Participating Experts
1
Solution Grade
A

Replies

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: DeltaAlphaNovemberEcho

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Log In

Forgot your password?Sign up

Stay Connected

Top Experts

  1. mlmcc

    351,274

    Wizard

    0 points yesterday

    Profile
  2. James0628

    76,896

    Master

    0 points yesterday

    Profile
  3. LinInDenver

    4,800

    0 points yesterday

    Profile
  4. peter57r

    4,000

    0 points yesterday

    Profile
  5. 13598

    3,520

    0 points yesterday

    Profile
  6. PCIIain

    1,700

    0 points yesterday

    Profile
  7. RickIsWright

    400

    0 points yesterday

    Profile
  8. Dan3D

    300

    0 points yesterday

    Profile

BrowseAre you an Expert?