Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simplify concantenated line of code
Message
De
17/07/2007 12:26:12
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
17/07/2007 12:17:54
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01241143
Message ID:
01241154
Vues:
27
>How to simplify this to remove the EVALUATE() and make it more readable?
>
>
>FOR ix = 1 to Whatever
>     REPLACE JMJ_IN.Diag1 WITH LEFT(ALLTRIM(UPPER(EVALUATE('loObj'+LTRIM(STR(m.ix))+".Field019"))),AT('^',EVALUATE('loObj'+LTRIM(STR(m.ix))+".Field019"))-1)
>ENDFOR
>
My first thought is, because this way you fire the eval and the object referencing once. Not tested of course.
FOR ix = 1 to Whatever
     m.lcString = EVALUATE('loObj'+LTRIM(STR(m.ix))+".Field019")
     REPLACE Diag1 WITH LEFT(ALLTRIM(UPPER(m.lcString)),AT('^',m.lcString)-1) IN JMJ_IN
ENDFOR
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform