Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Glen Villar
  Where is Glen Villar?
 Palayan City
 Philippines
 Glen Villar
 To: Rosalyn Panganoron
  Where is Rosalyn Panganoron?
 Tagum
 Philippines
 Rosalyn Panganoron
 Tags
Subject: RE: returning numeric without rounding off
Thread ID: 189031 Message ID: 189035 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Wednesday, August 13, 2008 3:49:06 AM         
   


> hi there...what function shall i use if i want to return a numeric data upto two decimal places only without rounding it off...for example i have 6.778, i want to return only 6.77

LOCAL lcValue As Integer, ;
lcGetVAlue As String, laObject AS String

lcValue = 126.7178
lcGetValue = ''
laObject = ALLTRIM(TRANSFORM(m.lcValue))

For nVar = 1 To LEN(m.laObject)
	lcGetValue = m.lcGetValue + Substr(m.laObject,nVar,1)
	If !Isdigit(Substr(m.laObject,nVar,1))
		lcGetValue = m.lcGetValue + Substr(m.laObject,nVar+1,2)
		Exit
	ENDIF
Next

Messagebox(m.lcGetValue)





(coffee)

ENTIRE THREAD

returning numeric without rounding off Posted by rosalyn panganoron @ 8/13/2008 3:08:17 AM
RE: returning numeric without rounding off Posted by Glenn Villar @ 8/13/2008 3:49:06 AM
RE: returning numeric without rounding off Posted by mike castillo @ 8/13/2008 3:59:45 AM
RE: returning numeric without rounding off Posted by tushar @ 8/13/2008 5:19:27 AM
RE: returning numeric without rounding off Posted by Yousfi Benameur @ 8/13/2008 12:48:38 PM