Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rule AfterNew()
Message
De
08/03/2003 03:14:32
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Titre:
Divers
Thread ID:
00762641
Message ID:
00763230
Vues:
18
Hi Mel:

>I didn't realize this. So, no matter what lAutoPk is set to, the AfterNew() code over-rules that - with the type of code I was using? And, you do something somewhat similar to what I was doing (with the suggestion you made of not using the regular fox replace)?

Yes.

>Would you mind showing me how the code would look for this:
*-- Assuming we are in a DM.
this.REPLACE('Fundstmp', 'FundTmpID', ;
   FundTmpID WITH PRIMARYKEY('Fundstmp','FundTmpID','Counters.Primary Key Batch Money') )
>Then, the following is placing the Parent key in the child view for the relation. However, wouldn't CodeMine have already done this... since the lPkAuto is set True in the CDE?
>
>THIS.Replace('Fundstmp','PeopleID',Person.PeopleID)
>
"lAutoPK" is a cursor related option set for each cursor and not a CDE related "overall" option. The updating of a child table's FK (from its parent's key field) has nothing to do with the lAutoPK setting - lAutoPK is only about the automatic assignment of a PK value for a cursor if you fail, deliberately or otherwise, to specifically add a PK value to the indiviual cursor when a new record is created. If there is a described relationship in the CDE (ie., for related tables, a cursor object has the appropriate values set like its own index order (cOrder), and its cParent and cParentKeyField values specified, Codemine knows how its managed cursors are related. So, if you take care of the PK for each individual cursor (although not totally necessary if lAutoPK is True for the individual cursor), Codemine will automatically update the FK field of each cursor in the parent's child cursor collection (as long as each cursor is known to the managed cursor list - ie., has been defined in the CDE or added to the managed cursor list using AddCursor()).

The main reason I am specifying that you take care of assigning the PK yourself in AfterNew() is that you can direct the PrimaryKey function to a specific key name/value in the CM "shared" registry. I just prefer this level of control and I suppose I like to see it happen.

>Again, thanks for the help - and the additional clarification.

No problem.

HTH
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform