StrataFrame Forum

ChildFormDialog and BO translations

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

By Sean P Kelly - 9/4/2009

Here is the short version of my problem:



I have several maintenance screens in my project.

I have a set of BOs where there is a parent child relationship.

For ease of reading. I have BudgetBO (parent), ItemBO (child), and AmountBO (grandchild). On the parent maintenance form I have a parent BO and child BO.

If the user attempts to edit a child record, a ChildFormDialog passes the childBO to the Item (child) maintenance form. On that form, I have a child BO and a grandchild BO with the parent/child relationship defined at design time. However, unless I have a grandchild BO on the parent form, and use the BO translator to pass both the child and grandchild BOs, the grandchild's ParentBusinessObject property is always Nothing.







More drawn out version:



Parent-child relationship:

BudgetBO.budget_pk <-> ItemBO.item_budget_pk



Child-grandchild relationship:

ItemBO.item_pk <-> AmountBO.amt_item_pk



On my budget maintenance screen, I have instances of BudgetBO and ItemBO.

On my item maintenance screen, I have instances of ItemBO and AmountBO.



The parent/child relationships are set at design time in both the BOs themselves and in their particular instances on the forms.



In the budget maintenance screen (parent BO), if the user edits an Item, I have a ChildFormDialog that uses the BO Translator to pass ItemBO to the child maintenance form. However, the parentbusinessobject property of the grandchild BO instance, AmountBO1, is not being set to ItemBO1 at Form_Load of the child form.



If I put parent, child, and grandchild BOs on the parent maintenance form, and use the BO translator to pass the child and grandchildBOs to the child maintenance form, it appears that the relationship between child and grandchild is in tact at Form_Load.





Question:



Is this a problem with the BO translator? Is it expected that I would put all three BOs on the parent form? Should I set the ParentBusinessObject property in code at the Form_Load of the child form?





Thanks for your time.



Sean Kelly

County of Santa Cruz
By Greg McGuffey - 9/4/2009

Sean,



Likely the issue is in how the translations happens. I've run into this before also and it appears that the translation doesn't attempt to figure out every single place it needs to update the pointer to the translated BO.



I just did my best to explain this in another post:



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



The long and short of it is that you need to reset the ParentBusinessObject property in the form load event handler. In your case, likely you'd need to reset it in the item form and then again on the amount form. Check out the post and see if this makes sense.
By Sean P Kelly - 9/4/2009

Thanks Greg. That is what we figured. I just wanted to make sure that it wasn't something different. I've noticed that at times having a filter or sort property populated causes things to behave differently than if they're blank. You've done your good deed for the day... now you can relax and enjoy the weekend.BigGrin
By Trent L. Taylor - 9/7/2009

I added the reasons why on the other thread that Greg had posted on as well.  If you need more explanation please let us know. Thanks.