How to handle an editing issue


Author
Message
Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I'm using a legacy database whereby the customer data was split up into two databases, so I have two BO's, say CustA and CustB.  Relationships are not set right now.

I have a form with the two BO's (CustA and CustB).  CustA is the primaryBO.  I fill CustB within the CustA_Navigated event. Everything is fine when the customer record exists in both tables, however when the customer record does not exits in CustB, which it will on occasion, I get an error indicating that there are no rows in the current datatable (CustB), when I click on the edit button on the maintenance form tool strip.

What I want to do is add some code to automatically perform an 'Add' on CustB when the editing state on CustA changes to 'Edit ', however the error occurs before the event is fired.  I also tried the  CustB's EditingStateChanged event and the FormEditingStateChanged event, but the error occurs before these events are fired as well.

Any idea on how to handle this particular issue?

Thanks

Tim

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
There a couple of settings that you might want to check. On the form, is the IncludeInFormEditType set to All Business Objects or Determine By Business Object? And on CustB BO, is the IncludeInFormEdit set to True?



The combination of these determine if the BO changes state (add/edit/save/undo/delete) when a maintenance form toolstrip button is clicked. In your case I believe you want the IncludeInFormEditType set to Primary Business Object, assuming CustA is the primary business object. The primary business object is typically the first one dropped on the form, so that may be causing problems too, if CustB was dropped first. I think you can set the primary business object right in the designer on the form's property sheet.



Once you have CustB no longer being put into edit/add, etc., then I think reacting to the EditingStateChanged on CustA would work fine.



Hope that helps.
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, you might also fix this by testing on the CustB.IsEmpty or CustB.Count > 0 just after you fill it, and if it's empty, then call Add() on it.
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