dbTalk Databases Forums  

VFP 6: Eliminating & in References

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss VFP 6: Eliminating & in References in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gene Wirchenko
 
Posts: n/a

Default VFP 6: Eliminating & in References - 12-21-2004 , 10:59 PM






I have some code with statements like:

what="sometable"

use (what)

select * from (what)

select * from othertable into cursor (what)

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Reply With Quote
  #2  
Old   
Esparta Palma
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-21-2004 , 11:33 PM






Try with:

?EVALAUTE(what+"."+SomeColumn)

HTH

-----------------------
Espartaco Palma
SysOp www.PortalFox.com
Mexico

Gene Wirchenko wrote:
Quote:
I have some code with statements like:

what="sometable"

use (what)

select * from (what)

select * from othertable into cursor (what)

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Reply With Quote
  #3  
Old   
Sietse Wijnker
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-22-2004 , 12:28 AM



You could also use the scatter function

SELECT (What)
SCATTER NAME loRecord MEMO
?loRecord.SomeColumn
The scatter to array is also possible, but the fields names are lost because
the values are placed inside an array. SCATTER MEMVAR can also be used.

Another posibility is not specifying the alias:
SELECT (What)
?SomeColumn
This works provided you 're absolutely sure the alias is selected as the
current alias. Point of warning is to have some kind of naming convention so
that the field value isn't mixed up with an existing variable (the field has
the precedence unless you're using the 'm.'-prefix)

HTH,
Sietse Wijnker

"Esparta Palma" <espartaQUITAESTOPRIMERO (AT) softhome (DOT) net> wrote

Quote:
Try with:

?EVALAUTE(what+"."+SomeColumn)

HTH

-----------------------
Espartaco Palma
SysOp www.PortalFox.com
Mexico

Gene Wirchenko wrote:
I have some code with statements like:

what="sometable"

use (what)

select * from (what)

select * from othertable into cursor (what)

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.



Reply With Quote
  #4  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-22-2004 , 10:59 AM



"Sietse Wijnker" <sietse.wijnker (AT) ATsw-software (DOT) nl> wrote:

Quote:
"Esparta Palma" <espartaQUITAESTOPRIMERO (AT) softhome (DOT) net> wrote in message
news:uLR6Ef%235EHA.2600 (AT) TK2MSFTNGP09 (DOT) phx.gbl...

Gene Wirchenko wrote:
I have some code with statements like:

what="sometable"

use (what)

select * from (what)

select * from othertable into cursor (what)

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Try with:

?EVALAUTE(what+"."+SomeColumn)
The idea is to have short easy-to-use reference. Putting two or
more of those in a statement would make it nearly unreadable. Even
one is not a picnic. (I have used this approach in the past.)

Quote:
You could also use the scatter function

SELECT (What)
SCATTER NAME loRecord MEMO
?loRecord.SomeColumn
The scatter to array is also possible, but the fields names are lost because
the values are placed inside an array. SCATTER MEMVAR can also be used.
I realised that I left something out from my OP. I am trying to
get one easy-to-use reference. Because many of my uses require a
character string, it has to be that, but that one that needs an object
reference currently must have &.

Quote:
Another posibility is not specifying the alias:
SELECT (What)
?SomeColumn
This works provided you 're absolutely sure the alias is selected as the
current alias. Point of warning is to have some kind of naming convention so
that the field value isn't mixed up with an existing variable (the field has
the precedence unless you're using the 'm.'-prefix)
No, I can not guarantee that. This use is in exactly those cases
where I may be dealing with more than one table or cursor at once.

I think I have found a chink in VFP syntax.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
  #5  
Old   
Jeroen van Kalken
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-22-2004 , 05:35 PM



On Tue, 21 Dec 2004 20:59:57 -0800, Gene Wirchenko
<genew (AT) mail (DOT) ocis.net> wrote:

Can't you just use aliases ?
Since you know the fieldname, you must be selecting from a know
structure and therefore could use some (internal) aliases

Quote:
I have some code with statements like:

what="sometable"

use (what)
use (what) alias Mydbffile


Quote:
select * from (what)

select * from othertable into cursor (what)
select * ... into cursor mydbf

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
  #6  
Old   
Jan
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-22-2004 , 09:03 PM



Gene,

Migrate your apps to Visual Objects, thats, how they do it.

Rgds
Jan

"Gene Wirchenko" <genew (AT) mail (DOT) ocis.net> wrote

Quote:
I have some code with statements like:

what="sometable"

use (what)

select * from (what)

select * from othertable into cursor (what)

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.



Reply With Quote
  #7  
Old   
Jeroen van Kalken
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-23-2004 , 05:13 PM



On Thu, 23 Dec 2004 00:35:46 +0100, Jeroen van Kalken
<I (AT) dont (DOT) like.spam> wrote:

Can't you just use aliases ?
Since you know the fieldname, you must be selecting from a know
structure and therefore could use some (internal) aliases

You can even use the same aliasname as you are now using for the
variable...
This gives you (what) as the filename, and 'what' as the alias
and you dont need any eval() or macro to get the desired fields

Quote:
I have some code with statements like:

what="sometable"

use (what)
use (what) alias what


Quote:
select * from (what)

select * from othertable into cursor (what)
select * ... into cursor what

? &what..somecolumn
? what.somecolumn

Quote:
Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
  #8  
Old   
Paul Pedersen
 
Posts: n/a

Default Re: VFP 6: Eliminating & in References - 12-23-2004 , 05:32 PM



If you don't want to use EVALUATE, then know the alias and use that. It's
not that much trouble.

In some of those cases, you select the work area and use only the field
name.



"Gene Wirchenko" <genew (AT) mail (DOT) ocis.net> wrote

Quote:
"Sietse Wijnker" <sietse.wijnker (AT) ATsw-software (DOT) nl> wrote:

"Esparta Palma" <espartaQUITAESTOPRIMERO (AT) softhome (DOT) net> wrote in message
news:uLR6Ef%235EHA.2600 (AT) TK2MSFTNGP09 (DOT) phx.gbl...

Gene Wirchenko wrote:
I have some code with statements like:

what="sometable"

use (what)

select * from (what)

select * from othertable into cursor (what)

? &what..somecolumn

Is it possible to get rid of that & use? I would like to write
? (what).somecolumn
but that is not legal syntax and
? what->somecolumn
is not valid because what is not a object.

Try with:

?EVALAUTE(what+"."+SomeColumn)

The idea is to have short easy-to-use reference. Putting two or
more of those in a statement would make it nearly unreadable. Even
one is not a picnic. (I have used this approach in the past.)

You could also use the scatter function

SELECT (What)
SCATTER NAME loRecord MEMO
?loRecord.SomeColumn
The scatter to array is also possible, but the fields names are lost
because
the values are placed inside an array. SCATTER MEMVAR can also be used.

I realised that I left something out from my OP. I am trying to
get one easy-to-use reference. Because many of my uses require a
character string, it has to be that, but that one that needs an object
reference currently must have &.

Another posibility is not specifying the alias:
SELECT (What)
?SomeColumn
This works provided you 're absolutely sure the alias is selected as the
current alias. Point of warning is to have some kind of naming convention
so
that the field value isn't mixed up with an existing variable (the field
has
the precedence unless you're using the 'm.'-prefix)

No, I can not guarantee that. This use is in exactly those cases
where I may be dealing with more than one table or cursor at once.

I think I have found a chink in VFP syntax.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.