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

 

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,"")

Related Articles

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

  1. 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 Reply

Your email address will not be published.