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