Parent/Child Maintenance Form Question


Author
Message
fparker
fparker
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 31, Visits: 199
Hello All,

I have a maintenance form with two business objects on it.  They are arranged in a parent/child relationship.  I also have some text boxes bound to each object on the form.  When the user hits the new button, I'd like a record to be created in both objects.  The primary key is not auto incremented on either object.  If I set the Form's IncludeInFormAddType property to AllBusinessObjects, I get a BusinessLayerException ("An error occurred while retrieving the primary key from the parent business object").  If I instead set the IncludeInFormAddType property back to PrimaryBusinessObject and put a call to the child object's Add() method in the handler for the parent object's AfterAddNew event, no exception will be raised and the child objects editing state will be Adding but the controls associated with the child object do not become enabled.  Is there a way to get this to work?  Thanks for your help.

Fran Parker

Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yes, this will work fine and we would not have the feature if it did not work.  Ben was warning about using this setting when adding new records.  Since the filter is automatically applied to the foreign keys then when a new record is created the child record will more than likely not be visible within the collection.  So it is best to set this to Off anytime a new parent or child record is being created until the foreign key fields have been set then you can turn it back on.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search