Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Intellisense in [] delimited query expressions, pls
Message
General information
Forum:
Visual FoxPro
Category:
VFPX/Sedna
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01050200
Message ID:
01053119
Views:
23
Alejandro,
sorry it took me so long to get back to you.
Don´t want to put too much time into it, but we´re talking about three things here: macro substitution, Evaluate() and name expressions.

Maybe I was wrong to have compared macros and Eval() and I should have rather said macros and name expressions.

While you can use two or even three interchangeably in some situations, there are some very distinct usages.
*this is more than twelve years old
*it creates sort of 'pointers' into arrays
*named after the open tables
*so you can change the structure of the table
*and don´t need to change data binding
SET SAFETY OFF
CREATE TABLE test (c12 C(12) NOT NULL, n31 N(3,1) NOT NULL )
SET SAFETY ON
PUBLIC aTbl(1,2)
aTbl(1,1)=ALIAS()
aTbl(1,2)="t" &&table signature
FOR m.nCntr1=1 TO 1 &&actually iterate over open tables
* use name expr to create public array
*  dimensioned to the fcount() of the table
 PUBLIC ("r"+LOWER(ALIAS())+"("+LTRIM(STR(FCOUNT(),3))+")")
* use name expr to scatter to this array
 SCATTER MEMO TO ("r"+ALIAS())
 FOR m.nCntr2=1 to FCOUNT()
* create variable names from table signature+field name
* resulting in: tC12 and tN31
  m.cTmp=aTbl(m.nCntr1,2)+FIELD(m.nCntr2)
  PUBLIC (m.cTmp)
* assign the 'pointer' value to the var ONLY POSSIBLE WITH MACRO
* resulting in: tC12=1, tN31=2
  &cTmp=m.nCntr2
* for demo purposes only:
  ?(m.cTmp)
* a bit funny
  ?(EVALUATE(m.cTmp))
* eVALuate() to get the VALUE!!!
  ?EVALUATE(m.cTmp)
 ENDFOR
ENDFOR
*check in debugger before clearing
*CLEAR ALL
There´s actually much more fun to it...
Cheers
G
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform