Remove decimal places from string in Crystal Report

Updated on     Kisan Patel

Problem:

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

If you’re convert number to text using ToText(x) function, it will also add decimal places.

Solution:
To fix the output, you need to use ToText(x, y, z) function as shown in below code:

ToText({#any_number},0,"")
The ToText function can be used to convert number, date, boolean, or time values to a string (text). It provides you with controls that let you control how the resulting string looks.

Here, we ToText(x, y, z) function to remove decimal places.

where,
x = The number to convert to text.
y = The number of decimal places to include in result (optional). The value will be rounded to that decimal place.
z = The character to use as the thousands separator. If you don’t specify one, it will use your application default. (Optional.)


SAP Crystal Report

Leave a Reply