Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Grid to Show All Child Records that Match Parent Ke
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 8
Database:
Visual FoxPro
Divers
Thread ID:
01073370
Message ID:
01073470
Vues:
45
>Thanks. I tried your code, but it didn't work either. I got the same results. Could there be some setting that is changing the way that it works? I was going to create a SQL query or local view or filter as a last resort.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (d:\works\traff\ctest.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   11/30/05 11:53:10 PM
*
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 463
	Width = 530
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT grid1 AS grid WITH ;
		Height = 157, ;
		Left = 29, ;
		Top = 20, ;
		Width = 320, ;
		Name = "Grid1"


	ADD OBJECT grid2 AS grid WITH ;
		Height = 200, ;
		Left = 23, ;
		Top = 202, ;
		Width = 461, ;
		Name = "Grid2"


	PROCEDURE Init
		thisform.Grid1.RecordSource = "MyParent"
		thisform.Grid2.RecordSource = "MyChild"
		thisform.Grid1.Refresh()
		thisform.Grid2.Refresh()
	ENDPROC


	PROCEDURE Load
		CREATE CURSOR MyParent (ParentId I, ParentName C(30))
		FOR lnFor = 1 TO 10
		    INSERT INTO MyParent VALUES (lnFor, "Parent # "+TRANSFORM(lnFor))
		NEXT

		CREATE CURSOR MyChild (ChildId I, ParentId I, ParentName C(30))
		lnParent = 0
		FOR lnFor = 1 TO 50
		    lnParent = lnParent + 1
		    IF lnParent > 10
		       lnParent = 1
		    ENDIF
		    INSERT INTO MyChild VALUES (lnFor, lnParent, "Parent # "+TRANSFORM(lnParent))
		NEXT
		INDEX ON ParentId TAG MyChild
		SET KEY TO MyParent.ParentId
	ENDPROC


	PROCEDURE grid1.AfterRowColChange
		LPARAMETERS nColIndex
		SET KEY TO MyParent.ParentId IN MyChild
		thisform.grid2.Refresh()
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform