Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro Expansion, and Name Expressions
Message
From
21/07/1999 16:16:57
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00243690
Message ID:
00244337
Views:
18
>I'm like *really* confused about macro expansions and name expressions. I start with the following code:
>
>
>* Grab a couple tempfile names
>
>lcFOrange= SUBSTR(SYS(2015), 3, 10) && taken from VFP help examples
>lcFExpend =SUBSTR(SYS(2015), 3, 10) && temp table name
>lcFCommit =SUBSTR(SYS(2015), 3, 10) && temp table name
>lcFOutput =SUBSTR(SYS(2015), 3, 10) && temp output file
>
>SELECT whatever into table (lcFExpend)
>
>
>This works, fine, but the (lcFExpend) then isn't a "real" alias that can be used to do things like
>
>
>WHERE (lcFExpend).fieldname="myvalue"
>
There are several ways out. First, since its name is rather random, you may not like to use it - use the alias instead:


SELECT whatever into table (lcFExpend)
lcFExpAlias=alias()

select * from (lcFExpend) aex into ...

Within the later select command, the "aex" is the local alias, so your Where clause would look like this:
WHERE aex.fieldname="myvalue"
In any other case, you may either
select (lcFexpAlias)
or
use (lcFExpend) again in 0 alias FExpend
and refer to its fields with FExpend.fieldname wherever you need it.

Still, I'd recommend using cursors instead. They vanish when closed, altogether with their .fpt and .?dx files. With tables, you must first make sure they're closed, then

erase (lcFExpend+".*")

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