Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing variable cursor names and their fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01515685
Message ID:
01515688
Vues:
58
That won't work -

(1) You can use macro
&lcCursor..Benefit WITH GrpsPlansCarrs.CovDesc8
(2) Better
IF SEEK(&lcCursor..GrpID+&lcCursor..PlanKey, "GrpsPlansCarrs", "Full_Key")

	REPLACE CarrID WITH GrpsPlansCarrs.Carr, ;
		Benefit WITH GrpsPlansCarrs.CovDesc8 ;
       	  in (m.lcCursor)
>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
>
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform