Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Number to string 2

Status
Not open for further replies.

kifaro

Programmer
Oct 4, 2002
54
0
0
US
Hi,
I need to covert a number to string without the decimals.

Example:
Str1=123.00
str2=456.00

str1+'-'+str2=123-456

Thanks
Aaron
 
the first thing i would do is change the formatting of the number field so that it does not show decimal points. then create a formula like this:

totext{number field}

that will make it into a text string
 
sstatzer,
Changing it to a number then changing it back to a string will only work if your numbers are set to default to having no decimal places. This is set in File/Options - Fields tab/Numbers button.

kifaro,
Your formula would be:
totext(str1,0)+"-"+totext(str2,0) Mike
 
<smaking my forehead> i didnt even realize he was starting with a string... i was thinking he was starting with a number... and the other comment makes sense since my default IS set up to not show decimals... sorry if i confused anyone...

<sighs> i started this morning with 2 good answers for people - i think i should have stopped then lol
 
sstatzer you won the prize. I didn't have it as a string, I had it as a number.

Thanks,
Aaron
 
For future reference simply use the following:

totext({numeric},0) --- totext(x,y) // x= numeric; y= # of decimals

Although, the other suggestions work, they take the long way around the barn. Rod Oatis
Venturi Technology Partners
Crystal Decisions Certified
Trainer/Consultant/Developer
Rod_Oatis@hotmail.com
 
How is this the long way around the barn when it's exactly when you've posted?

totext(str1,0)+&quot;-&quot;+totext(str2,0)

totext({numeric},0) Mike
 
Thanks k.

And a belated congarts to you on being
Tips Master Of The Week


Mike
 
Mike,

You are correct. Thanks for the correction. I apologize for the additional help effort, otherwise known as a nuisance.

Good catch. Rod Oatis
Venturi Technology Partners
Crystal Decisions Certified
Trainer/Consultant/Developer
Rod_Oatis@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top