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

>I have a AfterNew() in the CDE such as:
>
>DO CASE
> CASE m.cWorkarea == 'Fundstmp'
>  REPLACE PeopleID WITH Person.PeopleID
>  REPLACE FundTmpID WITH PRIMARYKEY('Fundstmp','FundTmpID','Counters.Primary
>Key Batch Money')
>ENDCASE
>
>am I correct in thinking that this code is not needed (in other words, when a new record is added, CodeMine automatically assigns a Primary key to the child view FundsTmp, and also automatically takes the value of Person.PeopleID and places it in the child field by the same name so that the child is related to the parent table). Am I correct in this assumption? So, if that is correct there is no reason for me to do this in code?

Correct. If the relationship is specified (described) between the cursors in the CDE, then CM will assign the appropriate PK/FK values. However, AfterNew() is still a good place to assign the PK value, IMHO. If you set lAutoPK True on a cursor, CM automatically adds a PK using PrimaryKey (via SetPrimaryKey()) if there is no code in the DBC's default rule or in AfterNew(). However, I like to have a little more control over my PK's than that! Just a point on the above code though, you really would be better of using the Codemine Replace() method rather than a native VFP Replace. Codemine's replace ensures that the FieldValid and AfterChange methods are called.

>My 'gut' feeling is his indexes were corrupted... but I could use a little assurance on this one. Anyone else have any thoughts or suggestions on this?

Don't know whether the indices were corrupt but the behaviour experienced is definately not normal. So, I wouldn't suspect Codemine here on this occasion <s>.

Seems like you have got your hands full at the moment Mel - hope its all going well.

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

Click here to load this message in the networking platform