removing decimals in crystal reports for number field
Asked Answered
B

3

6

I have a field year which is string type coming from db side.So I converted that to number and adding 1 more year to that to show like this:

 Year:2014-2015

Below is the formula.

'Year' & ':' & tonumber({FocusOnCustomer.YEAR})&'-'&(tonumber({FocusOnCustomer.YEAR})+1)

Everything is working fine in designer.But when I view the report in cr viewer I am getting data like this.

2,014.00-2,015.00

I want to remove decimals and comas

Bullhorn answered 12/5, 2014 at 12:57 Comment(0)
H
18

Try:

ToText( ToNumber({FocusOnCustomer.YEAR}), "#")
Huarache answered 12/5, 2014 at 13:34 Comment(2)
Hi Craig with this code I am getting only 2014.But I need to get 2014-2015.Please helpBullhorn
@user2846028 If craig's code gives you the string '2014' then what, logically, do you need to concatenate to make the string 'Year:2014-2015'? It's a very small jump from one to the other.Cochrane
C
5

Right-click on the field or formula Select Format Field On the Number tab, choose the format to use from the list or click Customize to create a custom format. Click OK

enter image description here

Website Link

Cozart answered 30/8, 2018 at 9:59 Comment(0)
M
0

ToText parameters:

ToText(x, y, z, w)

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.) w = The character to use as the decimal separator. If you don’t specify one, it will use your application default. (Optional.)

Meteoric answered 30/11, 2023 at 13:2 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.