Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New VFP feature I didn't know about. Did you?
Message
From
21/07/2000 15:39:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00395202
Message ID:
00395664
Views:
9
>>You also do not have to use -> anymore between the table and field names. You can replace it with a .
>Most of the time.Try this:
>open a table
>lcTableName = 'part' && table name
>lcFieldName = 'partno' && field name
>?part.&lcFieldName &&gives the value of part.partno
>?&lcTableName.&lcFieldName &&gives an error

The problem is that macro-expansion interprets the first '.' as a macro termination indicator; try &lcTableName..&lcFieldName or EVAL(lcTableName + '.' + lcFieldName) or

lcMyField = lcTableName + '.' + lcFieldName
? &lcMyField
? EVAL(lcMyField)

>?&lcTableName->&lcFieldName && gives the value of part.partno
>Whatta ya think?
>
>>
>>>Hey UT folks -
>>>Sometimes I feel like a total idiot savant with VFP. Some features I know as well as the people who designed them, then I hit something like this .. which is probably something everyone but me knew about.
>>>
>>>Here's the feature I didn't know about, but came across by accident:
>>>
>>>Did you know that when you issue a SCAN/ENDSCAN VFP automatically flips a SELECT back to the correct file when hitting the ENDSCAN without you having to explicitly doing so?
>>>
>>>Here's an example program:
>>>
>>>SELECT j1
>>>
>>>SCAN
>>> SELECT j2
>>> LOCATE FOR ord = j1->rec
>>> IF NOT FOUND()
>>> APPEND BLANK
>>> REPLACE ord with j1->rec
>>> ENDIF
>>>ENDSCAN
>>>
>>>Now I would have expected this to bomb, because I didn't issue a 'SELECT j1' after the REPLACE and there's no 'ord' field on the 'j2' file. But when the program hits the ENDSCAN, it reverts to 'j1' automatically!
>>>
>>>Please someone tell me this is new and not been around since VFP 3 or FoxPro 1.0. Yeesh!
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform