On Wed, Apr 23, 2008 at 6:41 AM, Karsten Weinert <[EMAIL PROTECTED]> wrote: > Extending the question asked a few days ago, how can I handle 1:[1,0] > relationships? > Assume I have a master table with some information and a details table > that may or may not > have optional info, but at most one row. > > In the minimal example below I can teach my form > to display this optional info, but by default, if I enter new optional > info, and move > forward and back through the masters dataset, the entered information is > lost. > > I added a onValueChanged handler which creates a new details row if > there is none, but > this seems not practical for two reason. First, if I enter a new > optional info and > *directly* move to the next master's row (by hitting next) and then back, the > information is still lost. Second, in my real form I have several data > controls for > the "details" table and it seems too tedious to add a event handler > for each of these > controls. > > Do you have another suggestion on how to handle this situation?
Karsten, In this case, I would make your Details Bizobj a child of your Master bizobj. What you need to do is set the following on the Details: - FillLinkFromParent = True - LinkField = "master_fk" In the Master Bizobj, you need to call the following method: - bizobj.addChild(DetailsBizobjReference) Now, if you call new on your Master bizobj, you can call new on your details bizobj and have the link through the master_fk automatically established. Uwe, I wouldn't do what you are proposing. It defeats the purpose of refactoring the details table out, not to mention with blank fields it's not the best design. Code overhead should be low enough where it is more beneficial to stick with the 1 or 0 relationship. Hope this helps. Nate L. _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]
