Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CLR and VFP
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00409695
Message ID:
00412943
Views:
25
Rick;

I use EVAL() whenever I can but EVAL() can't handle a few things like assignments (ie. the left side of an assigment) and things like full commands.

For assignements the STORE command and name expressions can be used to replace macro expansion many times. I have rarely seen anyone use it that way, but it works. For example...

*=====================================
LOCAL lcVarName, ;
lcStuff, ;
lcTarget

STORE "" TO m.lcStuff, ;
m.lcTarget
m.lcVarName = "m.lcTarget"
m.lcStuff = "Hello"

CLEAR
*Typical way of assigning unknown variable
&lcVarname = m.lcStuff
?m.lcTarget

m.lcStuff = "World"
* Using name expression
STORE m.lcStuff TO (m.lcVarname)
?m.lcTarget
*=====================================

And then there is using name expressions for setting values in tables, which I do see more often, such as...

*=====================================
LOCAL lcFieldName
m.lcFieldName = "cjunk"
create cursor junk( cJunk c(12))
append blank

replace (m.lcFieldname) with "Hello"
insert into junk ((m.lcfieldname)) values ("World")
clear
list
*=====================================

Now stringing together a full command, like building up a SQL statement in a variable and then executing it with macro substitution, I can't think of a way around that.
Jim Munn, MCSD
Visual Data Solutions
Previous
Reply
Map
View

Click here to load this message in the networking platform