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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cdbl function

Status
Not open for further replies.

gentforreal

Programmer
Oct 19, 2002
62
US
LongRange = iRadius / (((cos(cdbl(iStartLat * _
3.141592653589 / 180)) * 6076.) / 5280.) * 60)

(cdbl

is not recognized (vfp 6.0)

Is there an alternate statement to replace the cdbl with?
 
I don't think that is a valid function in any of the VFP versions. If you copied the code from somewhere. It may have been a user defined function (UDF) that someone else created. You can reference UDF's on a SQL statement.



Jim Osieczonek
Delta Business Group, LLC
 
Yes, I copied the code. I found it on the net, still trying to create a program that determines zips in a radius.. this is what I copied.

* THIS VARIABLE SETS THE RADIUS IN MILES
iRadius = 150

LatRange = iradius / ((6076 / 5280) * 60)
LongRange = iRadius / (((cos(cdbl(iStartLat * _
3.141592653589 / 180)) * 6076.) / 5280.) * 60)

LowLatitude = istartlat - LatRange
HighLatitude = istartlat + LatRange
LowLongitude = istartlong - LongRange
HighLongitude = istartlong + LongRange

Now you can create a SQL statement which limits the recordset of cities in this manner:

SELECT *
FROM Locations
WHERE Latitude <= [HighLatitude]
AND Latitude >= [LowLatitude]
AND Longitude >= [LowLongitude]
AND Longitude <= [HighLongitude]
 
gentforreal,

From what I gather, CDbl() in VB simply converts an expression to subtype double. In Foxpro you should be safe to simply remove the function reference:

LongRange = iRadius / (((cos((iStartLat * _
3.141592653589 / 180) * 6076.) / 5280.) * 60)

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top