Parent child bo's edit records


Author
Message
Jon Olson
Jon Olson
StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)
Group: Forum Members
Posts: 15, Visits: 17
I have a form with two tables that have a parent child relationship. I also have added the maintenance toolstrip. When I use the navigation buttons both tables update the fields as I would expect. When I select edit though it only edits the parent table? Can I have it automatically have the child edit as well.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yes.  Set the Form Include properties and the include properties on the business objects.  Read the help topic in the StrataFrame Help: Business Layer -> Configuring a Business Object -> Form Include Settings
Jon Olson
Jon Olson
StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)
Group: Forum Members
Posts: 15, Visits: 17
I have all those set but it still doesnt work.
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What is the value of IncludeInFormEdit on the form, and IncludeInFormEdit of the child busines object?

It should work if you set the IncludeInFormEdit of the form to AllBusinessObjects or set it to DeterminedByBusinessObject and set the IncludeInFormEdit of the child business object to True.

Jon Olson
Jon Olson
StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)
Group: Forum Members
Posts: 15, Visits: 17
okay that worked thanks for the quick reply
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No problem.
Chan
Chan
Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)Advanced StrataFrame User (725 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I tried this approach to add records. But I hit error when save. It is caused by



1. My ParentBO is PKIsAutoIncremented = true

2. When ChildBo.Add() called, ParentBO.PK is still null.



So, what is your suggestion? Update FK during BeforeSave event? Or any better way to do this?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
When ChildBo.Add() called, ParentBO.PK is still null.

Then you have one of two issues.  First, you have set the AllowNullValuesOnNewRow property on the business object to True.  Otherwise you will NEVER have a NULL value on a BO when a new record is created.  Second, if you have a primary key defined on the table, and the PrimaryKeyIsAutoIncrementing property is set to True, this value will be automatically managed for you.  Until saved to the server, the PK values will be negative numbers.

Update FK during BeforeSave event?

No.  StrataFrame will manage this for you automatically if you setup the relationships.  On the child BO, set the ParentRelationship property.  Once dropped on the form, set the ParentBusinessObject property to the appropriate parent BO and the FK value will be managed for you.

Note: This is shown in many of the samples.  I recommend looking at the Sample CRM application sample that was installed with StrataFrame.

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