![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a R/O cursor that is an extract from a table. I need it to be R/W so I can run some a what-if scenario on it. I would rather not create a table since I do not want to keep the data. How can I create a R/W version of the cursor that I have? Failing that, how can I create a R/W extract from a table? (The original table must not be modified by the subsequent writes.) Sincerely, Gene Wirchenko |
#3
| |||
| |||
|
|
I have a R/O cursor that is an extract from a table. I need it to be R/W so I can run some a what-if scenario on it. I would rather not create a table since I do not want to keep the data. How can I create a R/W version of the cursor that I have? R/O cursors mostly are hidden filters on the original table. |
#4
| |||
| |||
|
|
"Gene Wirchenko" <genew (AT) ucantrade (DOT) com.NOTHERE> wrote in message news:02k3a2l0dcllsclbnpopk8jn58mmai9mbt (AT) 4ax (DOT) com... I have a R/O cursor that is an extract from a table. I need it to be R/W so I can run some a what-if scenario on it. I would rather not create a table since I do not want to keep the data. How can I create a R/W version of the cursor that I have? Failing that, how can I create a R/W extract from a table? (The original table must not be modified by the subsequent writes.) This is what I used to do when I used VFP6. *--Create cursor SELECT * FROM Temp INTO CURSOR ReadOnlyCursor *--Put structure of cursor into array AFIELDS(laStruc, "ReadOnlyCursor") *--Create new cursor from structure array, new cursor will be read/write CREATE CURSOR ReadWriteCursor FROM ARRAY laStruc *--Append records from read only cursor APPEND FROM DBF("ReadOnlyCursor") |
#5
| |||
| |||
|
|
[Gene Wirchenko:] I have a R/O cursor that is an extract from a table. I need it to be R/W so I can run some a what-if scenario on it. I would rather not create a table since I do not want to keep the data. How can I create a R/W version of the cursor that I have? R/O cursors mostly are hidden filters on the original table. |
|
If you add a dummy field to the field list, then Foxpro mostly builds a separate cursor which is writable. Something like SELECT *, "" as dummy FROM ... INTO CURSOR ... should do the trick. |
|
Another way: CREATE a new cursor from the structure of your R/O cursor and append the rows from R/O cursor. |
#6
| |||
| |||
|
|
[corrected deleted attribution] On Wed, 28 Jun 2006 10:12:03 +0200, Bernhard Sander fuchs (AT) individsoft (DOT) de> wrote: [Gene Wirchenko:] I have a R/O cursor that is an extract from a table. I need it to be R/W so I can run some a what-if scenario on it. I would rather not create a table since I do not want to keep the data. How can I create a R/W version of the cursor that I have? R/O cursors mostly are hidden filters on the original table. No. I created the cursor with nofilter. This from the VFP 6 On-line Docs: CURSOR CursorName [NOFILTER], which stores query results in a cursor. If you specify the name of an open table, Visual FoxPro generates an error message. After SELECT is executed, the temporary cursor remains open and is active but is read-only. Once you close this temporary cursor, it is deleted. Cursors may exist as a temporary file on the drive or volume specified by SORTWORK. Why the cursor ends up R/O makes no sense to me, but that is how it is documented and how VFP 6 behaves. If you add a dummy field to the field list, then Foxpro mostly builds a separate cursor which is writable. Something like SELECT *, "" as dummy FROM ... INTO CURSOR ... should do the trick. It did not work for me. VFP said that the cursor was R/O. This is an old trick to avoid a filter. Another way: CREATE a new cursor from the structure of your R/O cursor and append the rows from R/O cursor. That did work. Someone posted code for this. Sincerely, Gene Wirchenko |
![]() |
| Thread Tools | |
| Display Modes | |
| |