Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining Character Strings
Message
From
14/08/2000 17:39:56
 
 
To
14/08/2000 15:47:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00404673
Message ID:
00404731
Views:
10
>Hey All,
>
>I have a table that I'm validating against...the fied I'm checking is called Pat_id. The format is 123-4567-89910. And the field is all character.
>
>How can I check to verify that the format of the id is 3, hyphen, 4, hyphen, 5.
>
>
>how can I create a class that handle that chcking

Jeff, if you can exclude the '-' characters from the internal storage format, you can set the Format property to 'R', and use an InputMask of '999-9999-99999'; the '-' will not be included in the value saved. The 'R' excludes any non-mask characters in the InputMask being saved; '-' is not a mask character, and the '9' character accepts a digit or sign, and obviously, people can arrow around to force a blank if they really want to hurt themselves; you then can validate by:

RETURN IIF(LEN(CHRTRAN(this.Value,'0123456789','')) = 0,.T.,0)

The result is that you get to proceed to the next field if the test is passed, and otherwise you remain in the field without the annoying error box. If you don't mind the standard VFP Valid failure message popping, simply:

RETURN (LEN(CHRTRAN(this.Value,'0123456789','')) = 0)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform