I do the following in one of my modules
sele 909 use (ltable) alias Junk1 Excl
If I issue wait window alias(), it returns Junk1
If I use (ltable) alias "Junk1" Excl, it returns Junk1 as well
Is this normal?
I ask because I have a client who consistently ends up with an error variable code not found when I know for sure the table has a field called Code, and I am trying to confirm the underlying table is indeed Junk1
On Wed, Jan 27, 2016 at 5:35 AM, Sytze de Boer sytze.kiss@gmail.com wrote:
sele 909 use (ltable) alias Junk1 Excl If I issue wait window alias(), it returns Junk1 If I use (ltable) alias "Junk1" Excl, it returns Junk1 as well Is this normal?
I don't use quotes when specifying an alias
I ask because I have a client who consistently ends up with an error variable code not found
If the table could not be opened, then table.code would not be accessible!
So my suggestions:
1. "select 0" is better than "select 909"! 2. Use used() to check whether the table was opened 3. Because you are trying to open a table EXCL, you should set ON ERROR! Better, use TRY... CATCH if you are using VFP 9.
LOCAL m.errhand
m.errhand=ON("ERROR") ON ERROR * SELECT 0 USE (lTable) EXCLUSIVE ALIAS junk1 ON ERROR &errhand IF USED() * * do your stuff * REPLACE junk1.code WITH ..... USE ENDIF
I agree with Man-Wai as well. Always use use use <file> again in select(0) to ensure you are selecting a file area that is not in use.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Man-wai Chang Sent: 27 January 2016 13:56 To: ProFox Email List profox@leafe.com Cc: profoxtech@leafe.com Subject: Re: Alias()
On Wed, Jan 27, 2016 at 5:35 AM, Sytze de Boer sytze.kiss@gmail.com wrote:
sele 909 use (ltable) alias Junk1 Excl If I issue wait window alias(), it returns Junk1 If I use (ltable) alias "Junk1" Excl, it returns Junk1 as well Is this normal?
I don't use quotes when specifying an alias
I ask because I have a client who consistently ends up with an error variable code not found
If the table could not be opened, then table.code would not be accessible!
So my suggestions:
1. "select 0" is better than "select 909"! 2. Use used() to check whether the table was opened 3. Because you are trying to open a table EXCL, you should set ON ERROR! Better, use TRY... CATCH if you are using VFP 9.
LOCAL m.errhand
m.errhand=ON("ERROR") ON ERROR * SELECT 0 USE (lTable) EXCLUSIVE ALIAS junk1 ON ERROR &errhand IF USED() * * do your stuff * REPLACE junk1.code WITH ..... USE ENDIF
-- .~. Might, Courage, Vision. SINCERITY! / v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3) /( _ )\ http://sites.google.com/site/changmw ^ ^ May the Force and farces be with you!
[excessive quoting removed by server]
Sytze, It is a bit of a quirk but does work and I never knew setting the alias Id to a character field worked.
I'd put a trace or an assert on the alias you are expecting being changed before you assign the table field somewhere.
The thing to look for is a udf somewhere that is not saving the alias used once the udf is entered and obviously resetting it back before it exits. The UDV can be programmatic or in fact a stub of Method code in a method for instance.
My guess is that somewhere the alias is being switched. Invariable these are no easy problems to track down!! Best of luck.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Sytze de Boer Sent: 26 January 2016 21:35 To: profox profox@leafe.com Subject: Alias()
I do the following in one of my modules
sele 909 use (ltable) alias Junk1 Excl
If I issue wait window alias(), it returns Junk1
If I use (ltable) alias "Junk1" Excl, it returns Junk1 as well
Is this normal?
I ask because I have a client who consistently ends up with an error variable code not found when I know for sure the table has a field called Code, and I am trying to confirm the underlying table is indeed Junk1
-- Kind regards, Sytze de Boer
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Sytze: "code" is a reserved word, the 4-letter abbreviation for "CODEPAGE" and would likely trip up the compiler in some cases.
My favorite reason for using Hungarian notation in Fox ('lccode' and 'tccode' and 'ccode') is not for self-documentation, but to out-Fox the compiler.
On Tue, Jan 26, 2016 at 4:35 PM, Sytze de Boer sytze.kiss@gmail.com wrote:
I do the following in one of my modules
sele 909 use (ltable) alias Junk1 Excl
If I issue wait window alias(), it returns Junk1
If I use (ltable) alias "Junk1" Excl, it returns Junk1 as well
Is this normal?
I ask because I have a client who consistently ends up with an error variable code not found when I know for sure the table has a field called Code, and I am trying to confirm the underlying table is indeed Junk1
-- Kind regards, Sytze de Boer
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
On 2016-01-27 09:28, Ted Roche wrote:
Sytze: "code" is a reserved word, the 4-letter abbreviation for "CODEPAGE" and would likely trip up the compiler in some cases.
My favorite reason for using Hungarian notation in Fox ('lccode' and 'tccode' and 'ccode') is not for self-documentation, but to out-Fox the compiler.
I still use Hungarian notation too, despite Microsoft telling us years ago that it's no longer acceptable style. Then again, we Foxers have always been rebels. lol
cF*ck cYou, oMicrosquish. :-)
I still use Hungarian notation too, despite Microsoft telling us years ago that it's no longer acceptable style. Then again, we Foxers have always been rebels. lol
For strongly-typed languages in modern development tools why would you use it?
Makes sense for VFP probably.
On Wed, Jan 27, 2016 at 11:54 AM, Alan Bourke alanpbourke@fastmail.fm wrote:
For strongly-typed languages in modern development tools why would you use it?
Brain bandwidth: "In this system, is this field cPassword or Password?"
My first PHP systems were reading and writing MySQL databases created from a Fox app, so they are still dragging around a naming convention they don't need.
Too often I finish a VFP editing session with :wq or try to modify a file from the Linux console with 'modi comm' :)
-- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com
Yes, it is normal, using an ALIAS or an "ALIAS" is the same thing, so ALIAS() return the normalized UPPER CASE alias.
2016-01-26 22:35 GMT+01:00 Sytze de Boer sytze.kiss@gmail.com:
I do the following in one of my modules
sele 909 use (ltable) alias Junk1 Excl
If I issue wait window alias(), it returns Junk1
If I use (ltable) alias "Junk1" Excl, it returns Junk1 as well
Is this normal?
I ask because I have a client who consistently ends up with an error variable code not found when I know for sure the table has a field called Code, and I am trying to confirm the underlying table is indeed Junk1
-- Kind regards, Sytze de Boer
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]