Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting field value
Message
From
01/07/2009 19:07:37
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01409674
Message ID:
01409687
Views:
52
>>Hi,
>>
>>Given alias of current table in cAlias and field name of one of its field cField:
>>
>>Is EVALUATE(cAlias + [.] + cField) or &cAlias..&cField better way to retrive field value?
>>
>>In this case, when alias and field name are both in variable, is there any other way to retrieve the field value?
>
>The first is much better. evaluate is the only way, like you showed (the table should be opened with the alias cAlias)
>
>See Choosing between Macro substitution and Name expressions FAQ #7841

>>Hi,
>>
>>Given alias of current table in cAlias and field name of one of its field cField:
>>
>>Is EVALUATE(cAlias + [.] + cField) or &cAlias..&cField better way to retrive field value?
>>
>>In this case, when alias and field name are both in variable, is there any other way to retrieve the field value?
>
>The first is much better. I believe evaluate is the only way, like you showed.

I find this in Hacker's Guide:

"In a command that will be executed repeatedly, it's generally better to use a macro than EVALUATE(). The macro is expanded once and substituted into the command while an EVALUATE() expression is evaluated each time the command executes. This is also true for scoped commands that apply to multiple records, like the BROWSE above. The macro is expanded once and the result used on each record; EVALUATE() is re-evaluated for each record. So, for the BROWSE above, you're better off issuing:

BROWSE FOR &cExpression
"
It seems that if I need to feed a scope command with field (which is determined by variables) value, I should use the latter, otherwise if I only need to retrieve the field value once, then may be I should use EVALUATE().
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform