Object that could potentially have multiple parents.


Author
Message
Geoff Hirst
Geoff Hirst
StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Guys,

What is best practice for a scenario where you may have an object, that may have a different parent object depending on the form it is used in? For example, I have an object called parts. Parts can be called in my application to create a proposal (kind of sales order) of which I presently have 4 different types, they may also be used in invoicing, they may also be used in Jobs, where again parts may be used for maintenance purposes.

thanks in advance

Geoff Hirst

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
If you are going to setup a relationship between the parent and the child, you may want to just manually use the RegisterForeignKey method.

bo.RegisterForeignKey(MyChildBO,"ChildFieldName")

When doing this, you can dynamically change the relationship between the parent BO and the child BO.  This does, however, have to be done in code and will require that you set the value of the child field when a new record is created.  But once that is done, all of the same functionality as using the ParentRelationship logic will still work, including the automatic update of child FK values if the parent is a new record, etc.

Geoff Hirst
Geoff Hirst
StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Trent,

Thanks for that chap, just what I needed.

Just another thing, should the naivgated event fire after a seektoprimarykey? Doesn't seem to be doing for me.

thanks for the help.

G.

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (660 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
The Navigated event won't fire after a seektoprimary key since a seek doesn't update the bound controls (which is the difference between "navigate" and "move".) The seek method will return True or False based on whether it is successfull, so you could test on that and fire off whatever code you needed to in the same code block.

If you do want to update the UI, however, you can use the NavigateToPrimaryKey, which will fire the Navigated event upon completion Smile.

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