Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find a bad zipcode
Message
 
To
17/11/2006 13:05:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01170759
Message ID:
01170776
Views:
7
>>>I have a character field zip c(5) containing zipcodes. I need to set a filter to select the bad entries which contain alpha characters. This is done in Access code using the LIKE function (not like('#####'), but VFP handles LIKE differently. This would also seem to be a simple matter but I can't seem to find the answer. I could find a bad entry by parsing the values but that doesn't serve my need to set a filter.
>>>
>>>Any thoughts?
>>
>>What about
>>
>>? transform(val(ZipCode)) == ZipCode && Valid Zip Code Assuming all 5 digits are always present
>
>Hugo -
>Thanks for your idea.
>The field is populated by a scanner using OCR, so there is no assurance that there will always be 5 characters. Plus nulls are allowed in the table.
>
>the following code:
>
>set filter to ! transform(val(ZipCode)) == ZipCode
>
>reveals blanks and zipcodes beginning with 0 as well as those containing alpha characters.
SET FILTER TO LEN(CHRTRAN(EVL(NVL(ZipCode,[A]),[A]),[0123456789],[])) > 0 OR;
              LEFT(ZipCode,1)  == [0] && Zero
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform