Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to code this
Message
 
 
To
29/04/2002 17:15:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00650620
Message ID:
00650708
Views:
16
You can create lookup table ZipToCounty and populate it once with ZIP and County combinations. That will simplify code significantly.
* ZipToCounty table: zip C(5), CountyCode C(2), CountyName C(11)
* ZIP      CountyCode CountyName 
* space(5) '00'       'None'
* '00000'  '00'       'None'
* '99999'  '00'       'None'
* '12045'  '01'       'Albany' 
* '12046'  '01'       'Albany' 
* '12047'  '01'       'Albany' 
* .......  ....       ........ 
* INDEX ON zip TAG zip

...
USE ZipToCounty IN 0
SET ORDER TO zip IN ZipToCounty 
SELECT mytable
SET RELATION TO zip1 INTO ZipToCounty 
SCAN FOR FOUND("ZipToCounty")
  REPLACE Cnty    with Val(ZipToCounty.CountyCode), ;
         CntyName with  ZipToCounty.CountyName, ;
         CityCd   with iif(Cnty >= 70 and Cnty <= 74,1,0 ) ,;
         Region   with iif(CityCd=1 or (str(Cnty,2) $ '28-47-55'),1,0) ;
ENDSCAN
>I'm stuck with this Dbase to vfp conversion,could any one tell me how to how to code this in VFP.
< snip >
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform