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


Author
Message
dgsoft
dgsoft
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 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
Reply
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K 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

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