I'm using SAP Crystal Reports.
I have a field called discount percent
. I'm making a if statement.
My question is: How do I make it a whole number if decimal places is .00
Sample:
50.00
43.12
60.40
20.00
13.00
Expected Result:
50
43.12
60.40
20
13
The following formula should return the expected result:
If {Table.discountpercent} = Round({Table.discountpercent}, 0) Then
ToText({Table.discountpercent}, 0)
Else
ToText({Table.discountpercent}, 2)
It checks if discountpercent
is equal to discountpercent
rounded to 0 decimals.
If yes, format with 0 decimals, if no, format with 2 decimals.