Question

Asked on 2009-09-23 at 07:04:21ID: 25190871

How to format a decimal number in Crystal

by: DeltaAlphaNovemberEcho500

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)

  1. Crystal Report XI
    I'm trying to create my first CR. I can't find a …
  2. Displaying Image in report
    I have a table which has a field listing the FILE N…
  3. time conversion
    I have a time stored as the system time (288…
  4. Establishing January 1st in a formula.
    Hello, I'm working on a few financial repor…
  5. A number is required here error
    I am creating a job cost summary type report wit…

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:

Posted on 2009-09-23 at 07:15:53ID: 26811314

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

Posted on 2009-09-23 at 07:21:30ID: 32717752

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

    334,774

    Wizard

    0 points yesterday

    Profile
  2. James0628

    70,696

    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?