Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Odd behavior with AFIELDS function
Message
From
14/06/1997 17:04:54
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
11/06/1997 15:20:09
Jody Cairns
OAO Technology Solutions
Moncton, New Brunswick, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00035943
Message ID:
00036393
Views:
46
> Here's a small program to illustrate the problem. It creates a table called > TMP. > Instead of using "t", try "lnNumFields". In that case, it worked! Go > figure. > > * Begin > LOCAL i, lcCreate, t > > lcCreate = SPACE(0) > > FOR i = ASC('a') TO ASC('z') > lcCreate = lcCreate + CHR(i) + ' C(10), ' > ENDFOR > > lcCreate = LEFT(lcCreate, LEN(lcCreate) - 2) > > lcCreate = 'CREATE TABLE tmp (' + lcCreate + ')' > > &lcCreate > > t = AFIELDS(laField) > > * The variable should be a Numeric type, since that's what AFIELDS() should > return. > * But for me, it is a Character type. > > WAIT WINDOW "TYPE(lcNumFields) = " + TYPE('t') > ?t Your table has a field named t, and if you reference a variable with no alias, you get the field from a currently selected table, as a default. So, if you ask for Type("t"), what you really get is Type("tmp.t"). What you wanted to know is Type("m.t"), which is the correct variable. > Anyone come across this? The number of times it came down to a thing like this is too big to be nice. That's the main reason all Foxen got used to writing m. before a variable - just to make sure.

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