Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simplify concantenated line of code
Message
De
17/07/2007 12:26:48
 
 
À
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:
01241156
Vues:
23
>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
>
Personally I hate expressions like that - long, complicated and unreadable. I'd break it down to its constuituent parts:
FOR ix = 1 to Whatever
     lxMyMeaningfulName = EVALUATE('loObj'+LTRIM ...           && See - can't be bothered decyphering it :-)
     lxMyMeaningfulName = LEFT(ALLTRIM(UPPER( lxMyMeaningfulName, ... 
     REPLACE Diag1 WITH lxMyMeaningfulName in JMJ_IN           
*    _____________                         _________
*    Note difference in replace - not repl table.field
ENDFOR
Forget it! By the time I'd replied the flies were all over your post! :-)
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform