Crystal Reports – Remove decimal places from string

Problem

You’re attempting to use a number, which is a string, in a formula but the output has leading decimal places.

For example, you’ve used the ‘Running Total Fields’ to summarise a number, which outputs a number with decimal places – such as 1.00.

When you try to use this number in a formula your output includes the .00

Crystal-RemoveDecimalPlaces1

Crystal-RemoveDecimalPlaces2

 

Solution

The easiest way to fix the output is to use the ‘ToText’ function. This allows you to apply formatting – most importantly, remove the decimal places.

An example of this is

totext({#count_client_invoices_cleared},0,"")

Crystal-RemoveDecimalPlaces3

Crystal-RemoveDecimalPlaces4

Tagged in

3 comments on “Crystal Reports – Remove decimal places from string

  1. This worked for me. I had a running total that gets reset on group change, so I had to use a running total in my group footer, and doing ToText with formatting got rid of the unwanted decimals. Thanks!

  2. Good day,
    I am trying to use the “ToText” function to change a unit price field to only have 2 decimal places however when I do this, I receive an error “Too many arguments have been given to this function”.
    My formula looks like this:
    totext({Documents/Document/DetailData/DetailLine/General.DetUnitPriceLocal},2,””)
    Any assistance is greatly appreciated!!!

Leave a Comment

Your email address will not be published. Required fields are marked *