Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming tables at runtime
Message
From
19/12/2003 14:15:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
19/12/2003 00:36:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00859829
Message ID:
00860787
Views:
23
>Seems to work for me
>
>
>lcTemp = 'james'
>CREATE CURSOR &lcTemp (field1 c(10), field2 c(10))
>
>
>creates a cursor named james. However, the other suggestions are better. I had just gotten through looking through some code with about umpteen thousand macro substitutions, must've been embedded in my brain (hehehe).

General advice is to stay away from macros for filenames, use name expressions. The above example will work, because "james" is a regular alias name, but imagine the situation where you're supplying a full filename:
lcFile=fullpath(forcepath("the.dbf", home()))
CREATE TABLE &lcFile (field1 c(10), field2 c(10))
This is guaranteed to break with a syntax error at runtime, if there's a space or any other nasty character in the path. However, a name expression will work even in that case:
lcFile=fullpath(forcepath("the.dbf", home()))
CREATE TABLE (lcFile) (field1 c(10), field2 c(10))

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform