crystal-reportscrystal-reports-xi

How to ignore zero decimal place values in Crystal Reports


I'm making a report and I need precise decimal values. A number could have a value of 2 decimal places and a number could have a value of 10. If I set the decimal range to 10 places that column will always show 10 decimal places of mostly 0's. How do I ignore 0's in the value if they are present? For example I like the data to show like this:

123.24
98.234
1212.678432

instead of:

123.2400000000
98.2340000000
1212.6784320000

Solution

  • Do the following:

    Important:

    1. Change the "{myproc;1.col1}" with the actual variable you are using.
    2. The last line is a formula that dictates how many decimal place would be shown. So after removing all the excess zero, it compute it by subtracting the position of the period with the length of the trimmed string.