Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Id
Message
From
02/01/2001 22:04:40
 
 
To
02/01/2001 19:06:00
Bill Breay
Custom Business Software
Arvada, Colorado, United States
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Miscellaneous
Thread ID:
00458705
Message ID:
00458755
Views:
20
>Hi All,
>
>I am haveing two problems, probabily related.
>
>I have a cbizobjmaintenance form with 5 pages. The first page has the list of the parent records, the second page has the detail for the parent and pages 3-5 each have a different child record. No problem here.
>
>The child bizobjs are set up as children of the parent in each biz obj.
>
>When I add a new parent, enter data in the detail page fields and click save before leaving the detail page (page 2) everything is OK. All child records are added and match to the parent.
>
>When I add a new record, enter data in the detail page fields and click on another page without clicking 'save' on the detail page and enter data on any of the children pages all records are added with data BUT the foreign key in the children records do not match the primary key of the parent.
>
>For example if the next parent primary key should be 100, the foreign key of each child record is 100 but the primary key of the parent is 101. The newid is apparently hitting twice.
>
>Also, (the second problem) I am not getting a 'Do you want to save the record' message if I move off the parent onto a child.
>
>There was a similiar thread last year but no conclusion was apparent.
>
>Any help would be apppreciated.
>
>TIA
>
>Regards
>
>Bill

Bill,

We'll have to break this one down to pieces. First, when you are saving a new record in the child bizobj, are you calling the form's save method? If so, then you are calling the primary bizobj's save method. Best thing to do is fetch the primary key from the primary bizobj and do a replace in the child bizobj's presavehook method. Then call the save method on the form. The save method of the primary bizobbj should check all the child objects and do saves if needed accordingly. To get the "do you want to save.." dialogue, you will need to code that logic into page deactivate event:
If thisform.IsChanged()
   Thisform.AskToSave()
Endif
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform