Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nesting case statements
Message
De
04/02/2005 14:13:48
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00983308
Message ID:
00983973
Vues:
28
This message has been marked as a message which has helped to the initial question of the thread.
Hi, Matthew-

>It is an @SAY..@GET prg based ui using VFP6 runtime. A series of CASE statements layout what will happen when various buttons are clicked. All buttons have a VALID btn_val('somestring')
>
>PROCEDURE btn_val
>   PARAMETER m.btnname
>     CASE m.btnname = 'somestring'
>         do some things
>     CASE m.btnname = 'someotherstring'
>         do some thing different
>*** and so on for 20 buttons or so
>     ENDCASE
Is the above code relevant to the problem?

>In one CASE the the user is marking the order complete so that the billing clerk can audit the order and send it to accounting.
>
>CASE  m.btnname = 'W_FINAL'
>		SELECT CDM30WRK
>		IF cmp_custid = 0
>			SELECT CDM10CMP
>			LOCATE FOR cmp_code = mCMP_CODE
>			IF cmp_custid <> 0
>				STORE cmp_custid TO lnCustID
>				SELECT CDM30WRK
>				LOCATE FOR wrk_order = mWRK_ORDER
>				REPLACE NEXT 1 cmp_custid WITH lnCustID
>			ENDIF
>			SELECT CDM30WRK
>		ENDIF
>		IF SUBSTR(WRK_STAT,1,1) = "9"
>			*** Audit this work order. If it is status complete,
>			*** change to Accounting or COD
>			DO CD300AUD
>			IF sw_035 = "Y"
>				@ 0.385,78.833 GET WRK_STAT PICTURE "@^" FROM ar_wstat;
>					SIZE 1.538,11.333 ;
>					DEFAULT "1-SCHED" ;
>					FONT "MS Sans Serif", 8 ;
>					STYLE "B" ;
>					COLOR ,,,,,,,,RGB(255,255,255,128,128,0),RGB(255,255,255,128,128,0)
>				DO CD017WAI
>				sw_300 = "C"
>				m.bailout = .T.	&&this is needed if used with FoxApp
>				CLEAR READ
>				RETURN
>			ENDIF
>		ELSE
>			*** if this is a normal user change the status to complete after popup
>			*** change the status without a popup if user level is greater than 5
>			IF xUSR_LEVEL < "5"
>				DO CD300FNL
>			ELSE
>				REPLACE NEXT 1 WRK_STAT WITH "9-COMPLT"
>				REPLACE NEXT 1 pers_updt WITH xUSR_CODE
>			ENDIF
>		ENDIF
>		mWRK_ORDER = WRK_ORDER
>		SEEK mWRK_ORDER
>		mWRK_PAGE = WRK_PAGE
>		mITM_LINE = 1
>		DO save_old
>		*** make sure we have a custid
>		IF cmp_custid = 0
>			SELECT CDM10CMP
>			LOCATE FOR cmp_code = mCMP_CODE
>			IF cmp_custid = 0
>				DO client_export_to_mdb && exports to Access
>			ENDIF
>			STORE cmp_custid TO lnCustID
>			SELECT CDM30WRK
>			LOCATE FOR wrk_order = mWRK_ORDER
>			REPLACE NEXT 1 cmp_custid WITH lnCustID
>		ENDIF
>		*** send the work order information to accounting.
>		IF SUBSTR(WRK_STAT, 1, 1) = "A" OR SUBSTR(WRK_STAT, 1, 1) = "C"
>			DO export_workorder_to_mdb && exports to Access
>		ENDIF
>		KEYBOARD "{ALT+1}" PLAIN
>So what is happening is that the routine is trying to export a client while the lower level user is executing the program. They do not have rights on that directory. They get a logon box from Access ODBC which fails, a wait window regarding a variable not found (since the export routine fails) that they can click though and the routine completes successfully.
>
>I would have thought that the ENDIF would terminate the lower level users participation in the code. But it does not

Which EndIf isn't doing what you think it should? The [IF xUSR_LEVEL < "5" ] ? If so, the line following the EndIf will execute and the code continue. The structure is definitely wrong if no more of the code should execute after [DO CD300FNL], but whether a DO CASE or IF is the right structure doesn't really have anything to do with the underlying logic. The only thing you have to decide about IF versus DO CASE is whether there is more than a binary state possible.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform