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!

Using truncate to remove decimal places 1

Status
Not open for further replies.

meumax

Programmer
Apr 13, 2002
38
0
0
AU
I have two number fields which I need to concatenate and I want to do this via a formula.

It needs to work thus: <number 1>.<number 2>

However, when I make a formula to do this it puts 2 decimal places at the end of each number so I end up with something like this &quot;99.00.3,499.00&quot; when I really want &quot;99.3499&quot;. (Incidentally, I also want to remove the &quot;,&quot; separator in 3,499).

I tried &quot;truncate(<number1>) & &quot;.&quot; & truncate(<number2>) but it failed to strip the decimal places like it says in the documentation. I've tried also &quot;int&quot; and &quot;round&quot; but also to no effect.

How do I rid myself off these decimal places?
 
Hi !

Try this:

ToText({number 1},0,&quot;&quot;)+'.' + ToText(number 2,0,&quot;&quot;)

/Goran
 
if I am reading this right, you have 2 numbers

number 1 = 99
number 2 = 3499

Your formula would be this:

{Number1}+{Number2}/10000

If these fileds are text, convert them to numbers as Garan suggested, then perform my calculation. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Thanks Goramn. you post has helped me.

I still find it puzzling that truncate doesn't work though because according to the documentation it's supposed to get rid of decimal places.

DGillz, your idea is good, however, I have many numbers of different lengths in my tables so dividing by 10000 wouldn't work all the time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top