Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simplifying code
Message
From
24/11/2005 09:26:44
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01071897
Message ID:
01071920
Views:
16
>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
>
LPARAMETERS m.tcfieldlabel1, m.tcfieldlabel2, m.tcfieldlabel3, m.tcfieldlabel4
LOCAL m.lnX
FOR m.lnX = 1 to PCOUNT()
  REPLACE expr with "'"+ALLTRIM( eval('m.tcfieldlabel' + transform(m.lnX)))+"'" IN cpplan
  SKIP in cpplan
ENDFOR m.lnX
Previous
Reply
Map
View

Click here to load this message in the networking platform