main logo
Subject: Builders and child bizobj's
Author: Mike Devlin
Posted: 2001/09/27 14:21:09
 
View Entire Thread
New Search


<i><font color="#663300">

Would someone like to give an generic explanation of using the builder and any "Gotcha's" when developing BizObj forms with One to Many and One to Many to Many relationships? I have built all of my views as single table with a single bizobj per view.... but am wondering if I need a separate bizobj for a child that is also a parent (ie Parent - Child - Grandchild relationship) and it gets worse! -- I also need forms showing 4 and 5 level relationships.... Tips would be greatly appreciated!

Thanks!
</font></i>
Hey Lynette,
One of the best things that I learned how to do was the creation and manipulation of the builders for the CodeBook controls. These builders are located in the builderc library. I used the builderi library to create my own builders, and subclass the base CodeBook builders. A real good tutorial is in the WIKI; title:'CodebookHowToMakeABuilder'. It walks you through the process. Making the builders does take time, but if you have some spare time, they can make things go quickly in the future. This is especially true for the CodeBook specific controls, like the bizobj's.

As far as getting the hierarchy set up, well that is easy. The primary bizobj needs to be set for the form. All the other bizobj's become children of this bizobj by default. But, to link one to another, the parent needs to have the ckeyfield field filled with the field that the child will be linking to. The child bizobj needs to have its view parameter set and the name of the expression for the parameter without the '?' needs to be in the cViewParmName property. Then it must be told who its parent is, which is done by putting the name of the parent bizobj (remember the number suffix)in the cParentBizobj property (this is alot easier if you are using the regisrty labels for the controls, that way you can just click the 'Select Parent BizObj...' button and choose the bizobj from the list of bizobj's on the form). Then make sure you have the 'lGetViewParmFromParent' property set to true and the NoDataOnLoad property set to .T. in the adataenv,prg file. Running a requery in the firms init() then gives the cild its data, filtered by the parameter value from its parent. To give the child bizobj a child of its own, just set the cKeyField of that bizobj to the field its child will be looking for, set up the parameter in the child view, let the child bizobj know which bizobj its parent is, etc, etc, and do the same process for its child. This can go on ad nauseum. The problem happens when you have two child views for the same bizobj, which are looking for two different fields from the parent. With only one cKeyField to fill and use for a child, this is tricky to handle, but I'll let the pros get into the cure for that.

I hope that helps answers the question.

Devman
mdevlin (at) ajdebruin DO.T com

 
©2001 Mike Devlin
<-- Prior Message New Search Next Message -->