Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code stored in a table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00857189
Message ID:
00857386
Vues:
29
>>>>Hi,
>>>>
>>>>I have a table like the following
>>>>
>>>>Condnum Condition
>>>>1 ALLTRIM(mytable.country) = "ITALY"
>>>>2 ALLTRIM(mytable.country) = "GERMANY"
>>>>3 ALLTRIM(mytable.country) = "SPAIN"
>>>>
>>>>I want to use this data in my code as follows:
>>>>
>>>>SELE mytable
>>>>STORE mytable.country TO m.condition
>>>>IF m.condition
>>>> ...
>>>> ...
>>>>ENDIF
>>>>
>>>>This does not work. I have also tried
>>>>IF &m.condition
>>>>But that does not work either.
>>>>
>>>>What am I doing wrong?
>>>
>>>This might work...
>>>
>>>IF &m..condition
>>> ...
>>> ...
>>>ENDIF
>>>
>>>
>>>The reason is that a macro needs a '.' after it, so you will need 2 '.'
>>
>>Sorry Victor, that wouldn't work either. It would look for a macro named "m". As others have pointed out, you need to use EVALUATE() or leave off the "m." altogether.
>
>Doooh! "m" would have to be a varable name to do it my way.
>
>Select MyTable
>lcCountry = mytable.country
>IF &lcCountry..Condition
> ...
> ...
>EndIF

Yep, that's when 2 "."s are required, one to terminate the macro and one for the "." separator between object.property/table.field names.

>
>I assume the EVALUATE() is faster though.

Unless it's in a loop and executed lots of times, I doubt that you could tell the difference.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform