(part 2)
Gene, about the alias thing:
If you have your table already open with something like this:
use ccli
Then you can re-open the same table under another alias this way:
use ccli alias *mytable again shared*
? *mytable*.clcode
...
use in (select("mytable"))
Interesting things about this:
- VFP does not create a second handle to the table, just reuse the existing
one with another name
- Because of that, the reopening with different aliases is the fastest way
to reuse an already opened table
- Each alias have it's own record pointer and can have it own index too,
without interfering with the other aliases
- Aliases allows you to encapsulate functionality for a group of tables
that share one or more fields when you need to treat them the same way
2018-02-15 20:50 GMT+01:00 Fernando D. Bozzo <[email protected]>:
> Gene, you did talk about objects, not tables and fields. They are not
> treated the same way.
>
> In this case, then Ted is right, the alias must be used.
>
> You can use generically with something like this:
>
> use ccli alias *mytable*
> ? *mytable*.clcode
>
> Nice thing about aliases is that you can use the same alias for any table
> in the case that those tables have the same fields you want to access.
>
>
>
>
> 2018-02-15 20:16 GMT+01:00 Gene Wirchenko <[email protected]>:
>
>> At 11:07 2018-02-15, Gene Wirchenko <[email protected]> wrote:
>>
>>> At 10:57 2018-02-15, "Fernando D. Bozzo" <[email protected]> wrote:
>>>
>>
>> To talk with an example, if you have this:
>>>>
>>>> oObj = createobject("custom")
>>>> reference = "oObj"
>>>>
>>>> The you have at least 3 options:
>>>>
>>>> 1) The way you know => &reference..referredto
>>>>
>>>> 2) Using evaluate => =Evaluate(reference + ".referredto")
>>>>
>>>> 3) My preferred: Caching the object and then using it:
>>>>
>>>> oRef = Evaluate(reference)
>>>> ? oRef.refered1
>>>> ? oRef.refered2
>>>> ...
>>>>
>>>
>>> I was hoping to avoid evaluate(), but your third way makes sense.
>>> I will check if it works in all the contexts I am thinking of. (I was
>>> using "object" and "reference" rather loosely.)
>>>
>>
>> Unfortunately, it does not work in my usual use case: as an alias.
>> Example:
>> use ccli
>> where=evaluate("ccli") && Nope
>> ? where.clcode
>>
>> Sincerely,
>>
>> Gene Wirchenko
>>
>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CAGQ_JumE_wB5unwo3=qi1jweabucu3gex46htewbex+jwie...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.