Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot Reuse Cursor Name
Message
From
30/09/2005 12:05:28
 
 
To
30/09/2005 10:14:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01054734
Message ID:
01054946
Views:
22
>>>Hi All,
>>>
>>>Here's my newest dilema.
>>>
>>>I want to SELECT a record set from a cursor and assign the result cursor the same name as the source cursor
>>>
>>>
>>>SELECT Field1 FROM crsTemp INTO CURSOR crsTemp GROUP BY Field1
>>>
>>>
>>>In most cases this query executes with no problem and all is well. However, sometimes I get an error message "Alias name is already in use."
>>>
>>>How is it that sometimes it works fine and other times I get an error message?
>>>
>>>Aloha,
>>>
>>>James
>>
>>If you select fields in the same order as the original table, sometimes VFP creates filtered set. Add NOFILTER to your statement to make sure the real cursor is created.
>
>The actual SELECT statement has both the NOFILTER and READWRITE parameters.
>
>Here's the actual commands:
>
>
>SELECT CompareCursor.UniqueID, CompareCursor.Positions, CompareCursor.Priority, ;
>		DupGroup.GroupNum, CAST(0 as I) as Sequence ;
>	FROM &lcCompareCursor CompareCursor ;
>	INNER JOIN &lcDupGroupCursor DupGroup ;
>	ON CompareCursor.MatchKey = DupGroup.MatchKey ;
>	INTO CURSOR crsMatchResults ;
>	ORDER BY GroupNum,Priority ;
>	READWRITE NOFILTER
>
>*!* Do some other stuff, including passing it to and accessing it from other methods
>
>*!* Then try to SELECT with only the fields required in the output cursor
>SELECT UniqueID,PassCode,DupCode,Priority ;
>	FROM crsMatchResults ;
>	INTO CURSOR crsMatchResults ;
>	GROUP BY UniqueID,PassCode,DupCode,Priority ;
>	READWRITE NOFILTER
>
>
>I tried to simplify it but perhpas I should have posted the actual commands to start with.
>
>Aloha,
>
>James
SELECT DISTINCT UniqueID,PassCode,DupCode,Priority ;
	FROM crsMatchResults ;
	INTO CURSOR crsMatchResults ;
         READWRITE
but if you don't add records this is sufficient:
SELECT UniqueID,PassCode,DupCode,Priority ;
	FROM crsMatchResults ;
	INTO CURSOR crsMatchResults ;
         READWRITE
Previous
Reply
Map
View

Click here to load this message in the networking platform