Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Am I Right?
Message
De
27/08/2006 23:29:35
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
27/08/2006 22:15:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01148960
Message ID:
01148966
Vues:
15
>Hi!
>I need a clarification to see if I'm right.
>This one is just to understand the way things are done.
>When accessing a table in another work area by ALIAS:
> - If using COMMANDS like USE, GOTO, etc. - we add a IN TABLE_ALIAS
> - If using FUNCTIONS like RECNO(), RECCOUNT(), etc. - we must enclose the TABLE ALIAS in quotes, passed as a String, or we got an error saying that "Variable not found".
>My question: Is that because they work as regular function like the ones we create or there is another reason?
>The first time I tried to use RECCOUNT() to operate in another area using table alias I spent a lot of time till I understand this. The VFP Help does not 'Help' in this situation because it does not make a note on this.
>Sorry for all of this.

When I came to use Fox in 1989, it was quite confusing to me that I could use filenames without quotes in some places, like the Use command. For me, being used to several other languages by then,
use "filename"
would be natural, but Fox and other xBase languages at the time allowed
use filename
syntax. Mmmm... OK, I said. But then, this omission of quotation marks works only in some places - in others, you must use them. Like in function calls, wherever an alias is required. So Fox knows whether it's a string literal or a variable that holds the name. So all of these work:
use mytable
use mytable.dbf
lcTable="mytable.dbf"
use &lctable      && wouldn't work if filename contained spaces
use (lcTable)     && works regardless of spaces
use "&lctable"    && works even with spaces but always looked dumb to me
now about aliases in functions:
lcAlias=alias()
?recno(lcAlias)   && works, it's a variable containing the alias
?recno("mytable") && works, it's a literal containing the alias
?recno(mytable)   && error, there's no variable called mytable

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform