Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pointer to location in table gets changed mysteriously
Message
De
28/08/2003 14:34:37
 
 
À
28/08/2003 13:12:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00824270
Message ID:
00824312
Vues:
22
I don't understand why you are locating at all in any of the events/methods if you have the parent-child relationships setup in the dataenvironment. I just tested this by creating a parent table and two child tables. I added all three to the form's data environment and dragged the parent's key field to both children's surrogate index keys to setup the relationship. The form shows the parent and the children in separate grids on the form. When I call the form and pass the key value of the parent table I want to go to, it locates the parent's record correctly and all three grids are displayed correctly with the children's record pointer pointing to the first matching child record in both child tables and the parent's table on the record with the value I passed to the form. Here is the init of the form ( I have no other code in any other properties on the form or the grid )

I call the form with: DO FORM parent WITH gotoid
*--gotoid should be character and is the primary key in the parent table
LPARAMETERS gotoid

*--No parameter passed
IF TYPE('gotoid')="L"
	gotoid=0
ENDIF

IF TYPE('gotoid')="C"
    IF VAL(gotoid)>0
        =SEEK(gotoid,'PARENT','ID')
        IF !FOUND('PARENT')
           SELE PARENT
           GO TOP
        ENDIF
    ELSE
        SELE PARENT
        GO TOP
    ENDIF
ELSE
    IF gotoid > 0
	=SEEK(ALLTRIM(STR(gotoid)),'PARENT','ID')
        IF !FOUND('PARENT')
           SELE PARENT
           GO TOP
        ENDIF
    ELSE  
        SELE PARENT
        GO TOP
    ENDIF
ENDIF

DODEFAULT()
>I'm having a heck of a time with the pointer in a table changing on me mysteriously.
>I collect the ID number I want to go to in one form and store it in gcPolid. Then I use the line:
> DO FORM editpolnew WITH gcpolid
>procedure init declares the parameter gcpolid, and procedure gotfocus has the following code:
>SELECT t_policies
>LOCATE FOR t_policies.polid = gcpolid
>IF NOT FOUND()
> thisform.lblStatus.caption = "Policy ID "+ gcPolid +" Not Found"
> thisform.refresh()
>ELSE
> thisform.lblStatus.caption = ""
> thisform.refresh()
>ENDIF
>SELECT t_name
>LOCATE FOR t_name.polid = gcpolid
>SELECT t_auth
>LOCATE FOR t_auth.polid = gcpolid
>SELECT t_rank
>LOCATE FOR t_rank.polid = gcpolid
>SELECT t_review
>LOCATE FOR t_review.polid = gcpolid
>
>This form has three pages on it, and the different pages have various grids that access the child tables (they are set up in the data environment, with the keys linked up)
>When I use the debugger, I can see that at points t_policies.polid equals gcpolid, which is where I just told it to point, but then further down it changes to the top of the list. What's going on?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform