Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing an object using a variable for the object na
Message
De
16/08/2001 12:56:59
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
16/08/2001 08:10:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00544237
Message ID:
00544816
Vues:
23
>In any case, folks, I figured it out. The only way I can get access the elements of an array that is a property of an object, when using a variable for the property reference is by using the macro designation; for some reason EVALUATE() returns only the first element of an array.

That EVALUATE() didn't work makes sense to me since it would do just that...EVAL the value of the variable, which returns the first element as you found, which is then passed to the function. That's not a very good explanation. But it's the same effect as if you pass an array by value instead of reference, you get the first array element. Another example, if you look at an array variable in the locals window, it shows as the value the first element. That's the effect EVAL() has.

The macro on the other hand replaces the string with a literal, which is the array variable, and then that variable is passed to the function.

I see your mistake was a common one, thinking the eval and macro would have the same effect, when they are quite different. They are similiar enough to be a bit confusing as to when to use which.

Glad you found it, and sorry we weren't more helpful. It was very hard to discern what the issue was in the original post. This was clearer.

Just as a side note to this, not specific to your example, is a nice quote from Hackers (www.hentzenwerke.com) that says: "In a command that will be executed repeatedly, it's generally better to use a macro than EVAL(). The macro is expanded once and substituted into the command while an EVAL() expression is evaluated each time the command executes."
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform