Re: Select from open view using DBF()
From: Ron Weldy (ronweldy_at_msn.com)
Date: 01/29/05
- Previous message: Josh Assing: "Re: Select from open view using DBF()"
- In reply to: Josh Assing: "Re: Select from open view using DBF()"
- Next in thread: Josh Assing: "Re: Select from open view using DBF()"
- Reply: Josh Assing: "Re: Select from open view using DBF()"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 22:40:41 -0800
Hmmm... but that's an alias. You are not using a view out of a database.
Maybe that's the difference. Or it could be that I have set the TMPFILES
term in my config.fpw like this:
TMPFILES=C:\TEMP
So you created an alias like this?
USE mytable ALIAS myalias
If so, dbf() should have returned your table name...
At any rate as I mentioned I'm using a parameterized view in a database. For
example let's call it myview. I suppose I could write some code to create
one but if you have a database with a parameterized view, set your variable
and use it like this:
lctheparameter = "parameter"
USE mydatabase!v_myview
SELECT * from DBF("v_myview")
This will bring up the open dialog when I execute this code.
Now, you mentioned Create Cursor and that inspired me to write this, which
does replicate the error:
CREATE CURSOR mytable (somefield c(10))
INSERT INTO mytable (somefield) VALUES ("test1")
SELECT * from DBF("mytable")
So you may be asking "Why does this dude want to select from the temp file,
why not just write
SELECT * from v_myview
and call it good?"
Let's say you buffer the view, and changes get made but they are not updated
using TABLEUPDATE. If you SELECT from the view name like I have above, you
will not see any un-saved changes as VFP appears to do a USE AGAIN and
selects from a new instance of the view. In fact, I think this is documented
in the KB and this method is the suggested workaround. I'll be darned if I
can find that article though...
I have worked around it by using copy to array and other commands, but it
would be easier and much more powerful if you could SELECT from a open,
buffered view. I suppose I could always report it if I go to the trouble of
coding it... unless they fixed this in 9.0 or there is some command or
method I don't know about. I'm using 8.0, btw.
Thanks for the chat!
- Ron
"Josh Assing" <xjoshx@jassing.com> wrote in message
news:lf8mv0pmcimc9tiirn9ktu46gmdgap4j1k@4ax.com...
> Can you provide code that replicates it?
>
> I just created an alias -- and did a select from dbf("MyAlias")
>
> the file it refers to does not exist (no big suprise here) -- and the
> select
> worked fine...
>
> What VFP? an d code to replicate it would be handy... (Create cursor)
> becuase my steps worked w/o error.
>
> On Fri, 28 Jan 2005 13:24:00 -0800, "Ron Weldy" <ronweldy@msn.com> wrote:
>
>>I simplified it while testing with the view open and executed it in the
>>command window using:
>>
>>SELECT * from DBF("v_myview")
>>
>>A straight DBF("v_myview") will return a file name of
>>c:\temp\J2GO003U.TMP,
>>but this file does not exist when looking at the temp folder. I also did a
>>search using windows explorer but could not find the file.
>>
>>
>>"Josh Assing" <xjoshx@jassing.com> wrote in message
>>news:cv9lv0t2ocvvplcpa6p4lvh6o95ri2pta0@4ax.com...
>>>
>>> what is your statement?
>>>
>>> On Fri, 28 Jan 2005 11:52:26 -0800, "Ron Weldy" <ronweldy@msn.com>
>>> wrote:
>>>
>>>>I am trying to SELECT from an open view using the DBF() function and it
>>>>errors saying 'table does not exist'. Interestingly enough, when I look
>>>>for
>>>>the tmp file name that DBF() returns, I can't find it either. Anyone
>>>>know
>>>>what's going on or how to do this?
>>>>
>>>
>>>
>>> ---
>>> Remove x's to send.
>>
>
>
> ---
> Remove x's to send.
- Previous message: Josh Assing: "Re: Select from open view using DBF()"
- In reply to: Josh Assing: "Re: Select from open view using DBF()"
- Next in thread: Josh Assing: "Re: Select from open view using DBF()"
- Reply: Josh Assing: "Re: Select from open view using DBF()"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|