Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro substitution and evaluate - which to use
Message
 
 
À
19/07/2007 10:46:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01241954
Message ID:
01241960
Vues:
28
>Hi All,
>
> I am trying to set up a select statement, I do not know the field name ahead of time. I do an AFIELDS() to get the field name, since there is only one field in the table. I need to change the field name to another name which I get before this select statement. I am thinks this way:
>
>SELECT EVALUATE(latmp[1]) as &lcnewfield. FROM &lcoldfile. ;
>   INTO TABLE lcnewfile DATABASE &lcTAbleDbc.
>
>
>Am I using the macro substitution too much? Can I do this easier? or nicer?
>
>TIA
>Beth

I would just create one select string and then either Execscript or macro.

E.g.
lcSelectSQL = 'select ' + ? + ' as ' + m.lcNewField + ' FROM ' + lcOldFile ...
&lcSelectSQL

Better yet to use textmerge
TEXT to lcSQL textmerge noshow
   select <<myField>> as <<MyNewField>>
endtext
See also Choosing between Macro substitution and Name expressions FAQ #7841
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform