dbTalk Databases Forums  

Can't find fields

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


Discuss Can't find fields in the comp.databases.xbase.fox forum.



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

Default Can't find fields - 02-21-2004 , 10:57 AM






Hi,

I'm wondering if someone can help me with a problem I'm having. I'm not a
programmer, but I wrote a program in Foxpro 8.0. This programs uses a few
tables. The problem I'm having is that I have one main table, I call it "&mid."
The name of this table changes everyday, I need to create and save a new table
everyday for my program to work right. What I do is use today's date and a
number and store that in, 'mid.' When I want to read or write to that table I
reference it by using "&mid.," example. "SELECT Time FROM &mid." I have no
problem reading and writing to '&mid,' but if I open one of the other tables
and read and write to them, then try to read and write to, '&mid' again, I get
an error saying Variable rank (this is the name of the field) not found. What I
do is a take some information from my other tables, do some work on the data
and try to put the new data in a field called,'rank', in table, '&mid.' I use
the replace command (tried using insert command but that didn't work), "
replace rank with XYZ(an element in a array)." I tried using, "Replace
&mid.rank with xyz" but I get an error message, "Command contains unrecognized
phrase/ keyword." I tried using the use command, 'Use &mid' but I get back an
error saying, "file is use." I also tried, "Use &mid in 0 (tried all the way up
to 10)," same error message. I tried using the open command, "Open database
&mid in 0" (Also tried all the way up to 10 and tried use, Open &mid in 0), I
get, "Command contains unrecognized phrase/keyword." I tried using, "Select
&mid in 0" and again get "Command contains unrecognized phrase/keyword."

If I don't open the other tables and just assign a value to, 'XYZ,' and use,
"replace rank with XYZ," I have no error messages and it puts it right in rank.

Any helpful ideas?

Reply With Quote
  #2  
Old   
Josh Assing
 
Posts: n/a

Default Re: Can't find fields - 02-21-2004 , 11:20 AM







do this:

use "&mid" alias MyData

then use mydata instead of "&mid."

replace MyData.rank with xyz

select time from mydata

avoid using macro expansion at all costs...



On 21 Feb 2004 16:57:06 GMT, jpgreenassoc (AT) aol (DOT) com (JPGREENASSOC) wrote:

Quote:
Hi,

I'm wondering if someone can help me with a problem I'm having. I'm not a
programmer, but I wrote a program in Foxpro 8.0. This programs uses a few
tables. The problem I'm having is that I have one main table, I call it "&mid."
The name of this table changes everyday, I need to create and save a new table
everyday for my program to work right. What I do is use today's date and a
number and store that in, 'mid.' When I want to read or write to that table I
reference it by using "&mid.," example. "SELECT Time FROM &mid." I have no
problem reading and writing to '&mid,' but if I open one of the other tables
and read and write to them, then try to read and write to, '&mid' again, I get
an error saying Variable rank (this is the name of the field) not found. What I
do is a take some information from my other tables, do some work on the data
and try to put the new data in a field called,'rank', in table, '&mid.' I use
the replace command (tried using insert command but that didn't work), "
replace rank with XYZ(an element in a array)." I tried using, "Replace
&mid.rank with xyz" but I get an error message, "Command contains unrecognized
phrase/ keyword." I tried using the use command, 'Use &mid' but I get back an
error saying, "file is use." I also tried, "Use &mid in 0 (tried all the way up
to 10)," same error message. I tried using the open command, "Open database
&mid in 0" (Also tried all the way up to 10 and tried use, Open &mid in 0), I
get, "Command contains unrecognized phrase/keyword." I tried using, "Select
&mid in 0" and again get "Command contains unrecognized phrase/keyword."

If I don't open the other tables and just assign a value to, 'XYZ,' and use,
"replace rank with XYZ," I have no error messages and it puts it right in rank.

Any helpful ideas?

---
Remove x's to send.


Reply With Quote
  #3  
Old   
JPGREENASSOC
 
Posts: n/a

Default Re: Can't find fields - 02-21-2004 , 02:05 PM



Josh Assing
Quote:
do this:

use "&mid" alias MyData

then use mydata instead of "&mid."

replace MyData.rank with xyz

select time from mydata

avoid using macro expansion at all costs...
JPGREEN

Thanks for answering, I tried what you wrote like this

USE &mid ALIAS Mydata
replace Mydata.rank WITH ranka
replace Mydata.rank2 WITH ranka2[sam2,3]

I also tried, USE "&mid" ALIAS Mydata, as you wrote is, both cases it came
back, "file in use"


Reply With Quote
  #4  
Old   
lemmebe@frednwilma.com
 
Posts: n/a

Default Re: Can't find fields - 02-21-2004 , 09:01 PM



On 21 Feb 2004 16:57:06 GMT, jpgreenassoc (AT) aol (DOT) com (JPGREENASSOC) wrote:

First of all, change the name of the table. Don't use an ampersand as the
first character of anything because Fox is liable to get confused. Fox sees
something like &mid as being macro substitution.

In other words, assume x = 5 and y = "x", then ? &y will print 5.

Try changing the name of the table, and see if that makes a difference.
Also, for what it's worth, I believe in always prefacing the field name with
the table name (mid.rank). Other variables should be prefaces with m. to let
fox know that you are referring to a memory variable. there have been a lot
of hours lost discovering that a memory variable has the same name as a
field that is in scope. The field gets priority.

If it still doesn't work properly, come back and let us know.

Alan

Quote:
Hi,

I'm wondering if someone can help me with a problem I'm having. I'm not a
programmer, but I wrote a program in Foxpro 8.0. This programs uses a few
tables. The problem I'm having is that I have one main table, I call it "&mid."
The name of this table changes everyday, I need to create and save a new table
everyday for my program to work right. What I do is use today's date and a
number and store that in, 'mid.' When I want to read or write to that table I
reference it by using "&mid.," example. "SELECT Time FROM &mid." I have no
problem reading and writing to '&mid,' but if I open one of the other tables
and read and write to them, then try to read and write to, '&mid' again, I get
an error saying Variable rank (this is the name of the field) not found. What I
do is a take some information from my other tables, do some work on the data
and try to put the new data in a field called,'rank', in table, '&mid.' I use
the replace command (tried using insert command but that didn't work), "
replace rank with XYZ(an element in a array)." I tried using, "Replace
&mid.rank with xyz" but I get an error message, "Command contains unrecognized
phrase/ keyword." I tried using the use command, 'Use &mid' but I get back an
error saying, "file is use." I also tried, "Use &mid in 0 (tried all the way up
to 10)," same error message. I tried using the open command, "Open database
&mid in 0" (Also tried all the way up to 10 and tried use, Open &mid in 0), I
get, "Command contains unrecognized phrase/keyword." I tried using, "Select
&mid in 0" and again get "Command contains unrecognized phrase/keyword."

If I don't open the other tables and just assign a value to, 'XYZ,' and use,
"replace rank with XYZ," I have no error messages and it puts it right in rank.

Any helpful ideas?
My real address is alan at sprint dot ca
(with a 'p' on 'alan' making it 'alanp',
and no spaces). I'm sick of email spam.


Reply With Quote
  #5  
Old   
Josh Assing
 
Posts: n/a

Default Re: Can't find fields - 02-22-2004 , 12:48 AM



how is "&mid" gettig created????

try use . again
it's not as hard as you're makiging it.....


On 21 Feb 2004 20:05:52 GMT, jpgreenassoc (AT) aol (DOT) com (JPGREENASSOC) wrote:

Quote:
Josh Assing
do this:

use "&mid" alias MyData

then use mydata instead of "&mid."

replace MyData.rank with xyz

select time from mydata

avoid using macro expansion at all costs...

JPGREEN

Thanks for answering, I tried what you wrote like this

USE &mid ALIAS Mydata
replace Mydata.rank WITH ranka
replace Mydata.rank2 WITH ranka2[sam2,3]

I also tried, USE "&mid" ALIAS Mydata, as you wrote is, both cases it came
back, "file in use"

---
Remove x's to send.


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.