Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing variable cursor names and their fields
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Referencing variable cursor names and their fields
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01515685
Message ID:
01515685
Views:
112
I just can't get FoxPro to go my way on this, so I must be wrong in my approach. In the following code, I loop through 12 cursors, each representing a month of the year. I then look for a combined key to find a record in another cursor that is indexed, with an INDEX TAG called FULL_KEY (GrpID+PlanKey). In the SEEK() below, this part won't compile, and it is obviously because I am referencing the cursor and its fields incorrectly, as in: IF SEEK((lcCursor).GrpID+(lcCursor).PlanKey, "GrpsPlansCarrs", "Full_Key")

How do you reference a field of a variable cursor name, in the below case?
FOR nMonth = 1 TO 12
	lcMonth = PADL(nMonth, 2, "0")
	* Get the Carrier ID (Matches GrpID and PlanKey) 
	* and the Benefit Name (Matches PlanKey).
	lcCursor=("tmpNearly"+lcMonth)
	SELECT (lcCursor)
	SCAN
		IF SEEK((lcCursor).GrpID+(lcCursor).PlanKey, "GrpsPlansCarrs", "Full_Key")
			REPLACE (lcCursor).CarrID WITH GrpsPlansCarrs.Carr, ;
				(lcCursor).Benefit WITH GrpsPlansCarrs.CovDesc8
		ENDIF
	ENDSCAN
ENDFOR
Maybe the below might work?
IF SEEK((lcCursor)+".GrpID"+(lcCursor)+".PlanKey", "GrpsPlansCarrs", "Full_Key")
			REPLACE (lcCursor)+".CarrID" WITH GrpsPlansCarrs.Carr, ;
				(lcCursor)+".Benefit" WITH GrpsPlansCarrs.CovDesc8
Next
Reply
Map
View

Click here to load this message in the networking platform