Conflict between interface and database logic. Need help (idea)


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Hi Dennis,

You may have a good reason for using a trigger on your master table, but if you are always adding a slave (child) object on the same form whenever you add a master (parent) object, you may be better off using the SF parent/child functionality to maintain a one-to-one relationship. This would eliminate the save issue you are currently seeing. Of course if your application allows a parent object to be added by itself on a form or by other means and you need to ensure that a default child object is also added, the trigger would be the way to go.

-Larry

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
I basically enumerate the BO and change the status like this:





For Each StockBO As bizTransactionItemsStock In Me.BizTransactionItemsStock1.GetEnumerable()

If StockBO.CurrentRow.RowState <> Data.DataRowState.Modified Then

StockBO.CurrentRow.SetModified()

End If

Next





In the above sample bizTransactionItemsStock1 is the BO.

Edhy Rijo

dgsoft
dgsoft
StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)
Group: StrataFrame Users
Posts: 93, Visits: 236
Hi,

In my case it should not be added.. it must be 'modified'..



The problem is.. my BO on the form has one "ADDED" row.. but after MASTER table .SAVE() - the record appears in SLAVE TABLE by trigger..

When I save SLAVE BO - then I have error with duplicate records.



When I copy data to another instance of BO and try to save its not commit changes after MergeDataFrom()

even if I call Edit() and change property SetDirtyOnEdit true.



How can I change the rowstate? This property is ReadOnly



Thanks

Denis
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
dgsoft (06/17/2010)
The idea with MergeDataFrom() maybe not bad in this case.. but - it does not bring changes to the database after Save() (but in debugger I can see updated CurrentDataTable with new values). Why?




Hi Denis,



Probably the row state is being reset like in some cases of CopyDataFrom() and you may need to enumerate the BO and set the row state to "adding".

Edhy Rijo

dgsoft
dgsoft
StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)
Group: StrataFrame Users
Posts: 93, Visits: 236
The idea with MergeDataFrom() maybe not bad in this case.. but - it does not bring changes to the database after Save() (but in debugger I can see updated CurrentDataTable with new values). Why?
dgsoft
dgsoft
StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)StrataFrame User (135 reputation)
Group: StrataFrame Users
Posts: 93, Visits: 236
Hi,

I have for example 2 tables with 1-to-1 relation.

When I add record to Master table - INSERT trigger add record to SLAVE table



Now I have a form where data from 2 tables present.

When I click "NEW" toobar button I must be able to modify data like all fields located in same table.

For this reason I have 2 BO on the form and set of textboxes with data binging.



Problem begins when I click "SAVE"



When I save MASTER table - trigger automatically creates record in SLAVE table, and when I call SAVE() for child BO - I have key duplicates.



I try to create instance of same BO and try to make MergeFrom() but data is not updated.



Need idea, how to be in this case.. what the best solution for it?



Thanks

Denis
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