Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loops
Message
De
04/04/2007 13:57:34
Walter Meester
HoogkarspelPays-Bas
 
 
À
04/04/2007 11:20:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Loops
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01211796
Message ID:
01212129
Vues:
11
Hi Edward,

Though I recognize everyone has a certain coding style and I have no remarks on readability in this case (I think its just fine), personally I'd have attacked it differently.
This one should be faster.

I took out the evals as you do select the work area. If some some reason it switched the alias (bound gridcolumns do strange things when painted), I'd go for a macro and do a COUNT FOR ... IN ...
	SELECT (cMembdepalias)
	
        LOCATE FOR (EMPTY(cDepssn) OR  ssn == cDepssn) AND ;
                   ALLTRIM(lastname) ==cExtdeplastname AND ;
                   ALLTRIM(firstname)==Alltrim(Evaluate('oExtmember.dep'+cLoop+'fname')) AND ;
                   deptype     == cDeptype AND ;
                   gender      == Evaluate('oExtmember.dep'+cLoop+'sex') AND ;
		   dob         == Evaluate('oExtmember.dep'+cLoop+'birth') AND ;
	           termdate    == Evaluate('oExtmember.dep'+cLoop+'termdt') AND ;
                   termcode    == Evaluate('oExtmember.dep'+cLoop+'tcd') AND ;
	           extendcode  == Evaluate('oExtmember.dep'+cLoop+'extend') AND ;
                   status      == Evaluate('oExtmember.dep'+cLoop+'status') 

        IF FOUND() 
	        Replace checkflag With .T. In (cMembdepalias)
	ELSE
		If Not Empty(cAlias)
			Select (cAlias)
		Endif
		Use In (cMembdepalias)
		Return 'command1'
	ENDIF
If some reason this is less desireble I'd go for:
lFound=.F.
Select (cMembdepalias)
SCAN WHILE lFound = .f.
	DO CASE
		CASE Not Empty(cDepssn) And Not (Evaluate(cMembdepalias+'.ssn')==cDepssn)

		CASE Not (Alltrim(Evaluate(cMembdepalias+'.lastname'))==cExtdeplastname)

		CASE Not (Alltrim(Evaluate(cMembdepalias+'.firstname'))==Alltrim(Evaluate('oExtmember.dep'+cLoop+'fname')))
		CASE Not (Evaluate(cMembdepalias+'.deptype')==cDeptype)
		
                CASE Not (Evaluate(cMembdepalias+'.gender')==Evaluate('oExtmember.dep'+cLoop+'sex'))

		CASE Evaluate(cMembdepalias+'.dob')<>Evaluate('oExtmember.dep'+cLoop+'birth')

                CASE Evaluate(cMembdepalias+'.termdate')<>Evaluate('oExtmember.dep'+cLoop+'termdt')

		CASE Not (Evaluate(cMembdepalias+'.termcode')==Evaluate('oExtmember.dep'+cLoop+'tcd'))

		CASE Not (Evaluate(cMembdepalias+'.extendcode')==Evaluate('oExtmember.dep'+cLoop+'extend'))

		CASE Not (Evaluate(cMembdepalias+'.status')==Evaluate('oExtmember.dep'+cLoop+'status'))

                OTHERWISE
    			Replace checkflag With .T. In &cMembdepalias.
			lFound=.T.
	ENDSCAN
	If lFound=.F.
		If Not Empty(cAlias)
			Select (cAlias)
		Endif
		Use In &cMembdepalias.
		Return 'command1'
	Endif
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform