Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF...ENDIF
Message
From
09/04/2001 21:16:28
 
 
To
09/04/2001 16:52:30
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00493778
Message ID:
00493859
Views:
17
>
IF NOT LEN(CHRTRAN(m.dv," ",""))=2
>	Messagebox('Please check the Division again.',64)
>	RETURN .F.
>ENDIF
>IF NOT EMPTY(m.dp)
>	IF NOT LEN(CHRTRAN(m.dv," ",""))=2
>		Messagebox('Please check the Department again.',64)
>		RETURN .F.
>	ELSE
>		IF NOT EMPTY(m.sd)
>			IF NOT LEN(CHRTRAN(m.sd," ",""))=2
>				Messagebox('Please check the Sub-deparment again.',64)
>				RETURN .F.
>			ENDIF
>		ENDIF
>	ENDIF
>ENDIF
>

What about:
DO CASE
CASE LEN(ALLTRIM(m.dv)) # 2
	Messagebox('Please check the Division again.',64)
	RETURN .F.
CASE EMPTY(m.dp) AND EMPTY(m.sd)
CASE EMPTY(m.dp) AND LEN(ALLTRIM(m.sd)) = 2
CASE EMPTY(m.sd) AND LEN(ALLTRIM(m.dp)) = 2
CASE LEN(ALLTRIM(m.dp)) # 2
	Messagebox('Please check the Department again.',64)
	RETURN .F.
CASE LEN(ALLTRIM(m.sd)) # 2
	Messagebox('Please check the Sub-deparment again.',64)
	RETURN .F.
ENDCASE
RETURN .T.
>Can someone help here? What is going on is the first field (m.dv) must have 2 characterse (can not have any spaces), or nothing else.. That's the first thing and it can go on with m.dv alone. Then, if there is a department, then there must be a 2 characters (can not have spaces either), then go on... The following samples are all acceptable:
>
>02 (which means only m.dv)
>0210 (which means m.dv+m.dp)
>021050 (which means m.dv+m.dp+m.sd)
>
>The follwing are NOT acceptable:
>2.....
>021...
>02105.
>0210.0
>02..50
>0.1.5.
>021.50
>
>Understand? Would I need another ELSE? Or the whole thing should be DO CASE...ENDCASE?
>
>Chuck
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