Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simplifying code
Message
De
24/11/2005 08:34:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01071897
Message ID:
01071905
Vues:
21
>Is there anyway I can cut this code down maybe using a for statement or something?
>
>
>PROCEDURE UpdLabel
>	LPARAMETERS lcfieldlabel1, lcfieldlabel2, lcfieldlabel3, lcfieldlabel4
>	SELECT cpplan
>	replace cpplan.expr WITH "'"+ALLTRIM(lcfieldlabel1)+"'" &&lcfieldlabel1
>	SKIP
>	replace cpplan.expr WITH "'"+ALLTRIM(lcfieldlabel2)+"'" &&lcfieldlabel2
>	SKIP
>	replace cpplan.expr WITH "'"+ALLTRIM(lcfieldlabel3)+"'" &&lcfieldlabel3
>	SKIP
>	replace cpplan.expr WITH "'"+ALLTRIM(lcfieldlabel4)+"'" &&lcfieldlabel4
>ENDPROC
>
procedure updlabel
lparameters lcArrayoflabel
local lncount,i
lncount=alen(lcarrayoflabel)
select cpplan
for i=1 to lncount
replace cpplan.expr WITH "'"+ALLTRIM(lcaarayoflabel(i))+"'"
skip in cpplan
endfor
endproc

the only thing to remember is to pass an array by reference as @laaray
* Human is a question asked by birth and answered by death. Machine is another kind of question with another kind of answer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform