Link to home
Start Free TrialLog in
Avatar of f4ichick02
f4ichick02Flag for United States of America

asked on

How to remove an actual period from a number

I cannot figure out how to remove the period from a number formatted field in Crystal Reports. So basically here is the situation:

For the amounts.....
  • 501.20
  • 21001.93
  • 792.00

I need them to output like this:
50120
2100193
79200

Does anyone have any suggestions on things I can try? I already tried Replace and ToText and a couple others with nosuccess. Thank you in advance.
Avatar of n2fc
n2fc
Flag of United States of America image

To remove decimals in crystal reports you can use the function cstr or ToText which both are equivalent.  
It´s possible to convert Numbers, Currency, Date, Time and DateTime.

//Code
NumberVar totalPay := 110.55;
cstr(totalPay, 0);
//End

or

//Code
NumberVar totalPay := 110.55;
ToText(totalPay, 0);
//End

The above functions will return the string “110” – In words, the NumberVar but with zero decimals.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of f4ichick02

ASKER

I do NOT want to lose the decimal places so the very first one will not work. mlmcc: I am going to try your solution shortly here and I will let you know if it works the way I need it to. Thank you so far for everything both of you
mlmcc: I just tried using what you suggested which worked perfect(See below for the one I used). Thank you so much for your help!

Replace(CStr({YourField},2,''),'.','')