StrataFrame Forum

Just to make sure I didn't miss a step...

http://forum.strataframe.net/Topic10455.aspx

By Robert Carl Johnson - 7/19/2007

Hi all. Ok, say I have a Inventory header table and a Inventory detail table (a one to many relationship). I have created a maint form and have populated my InventoryHeaderBO on it (Parent) with edit fields. Now I have below a datagrid for the InventoryDetailBO (Child).



I have placed InventoryHeaderBO, InventoryDetailBO and InventoryBBS ( A Business Binding Source) on my form and set them:



Step 1. I set the Child-Parent Relationship in the Child BO to the proper key columns



Step 2. Set the Parent BO on the child BO to the InventoryHeaderBO



Step 3. Set the child BO ChildAutoFilterOption to MatchCurrentRow



Step 4. In the form load I call the InventoryHeaderBO FillTop100 sub



Step 5. Set the grid to the InventoryDetailBBS



Now, IF I understand what I have read in the docs and in various threads, I do NOT have to make a call to FillbyParentPrimaryKey because I set The ChildAutoFilterOption to MatchCurrentRow which should automagically keep things in sync with the parent records. Is that correct?



Did I leave any steps out?



If not, why isn't my form working as it should?



Regards,



Robert
By Trent L. Taylor - 7/19/2007

I do NOT have to make a call to FillbyParentPrimaryKey because I set The ChildAutoFilterOption to MatchCurrentRow which should automagically keep things in sync with the parent records. Is that correct?

No.  This only filters records that are already populated within the BO.  You still need to call the FillByParentPrimarykey in the navigated event of the parent BO.  If you want "auto-magic" so to speak, the only control that does that is the BusinessLayerLinkManager which is used to tie link tables together.  In that case you can load the parent and it will automatically populate the children tables.  But your example is not a link table, it is just a parent/child and you still need to load the child records.

By Robert Carl Johnson - 7/19/2007

Thanks Trent. So I was on the right track except for one thing. Ok, so do I make the FillByParent PrimaryKey call in the Load event? Or where?



Robert
By Trent L. Taylor - 7/19/2007

call in the Load event? Or where?

Really the best place is in the Navigated event of the parent BO.

By Robert Carl Johnson - 7/19/2007

Thanks again Trent, that's exactly where I put it and it works great. I appreciate all the help.



Regards,



Robert
By Trent L. Taylor - 7/19/2007

No problem Smile