Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing an object using a variable for the object na
Message
From
16/08/2001 12:56:59
 
 
To
16/08/2001 08:10:07
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00544237
Message ID:
00544816
Views:
14
>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."
Previous
Reply
Map
View

Click here to load this message in the networking platform