Master-Detail and cached updates

Gorby

Member
Hi,

Problem description:

Two OracleDataSets: odsMaster and odsDetails in master-detail relationship. The programm works in the way that odsDetails can be modified only when odsMaster is in dsEdit/dsInsert mode.

odsMaster.CachedUpdates := False
odsDetails.CachedUpdates := True

for both datasets CommitOnPost := False

Event handler odsMaster.AfterPost calls:
odsDetails.Session.ApplyUpdates([odsDetails], False);
odsDetails.Session.CommitUpdates([odsDetails])

Event handler odsMaster.BeforeCancel calls:
odsDetails.CancelUpdates

Everything works fine except one:
When odsDetails is in dsInsert/dsEdit mode and user does odsMaster.Cancel, odsDetails.Post (well, somewhere internally) gets called and user can occasionally get some validation exception because user didn't finish entering data. I checked that post is made with event handler odsDetails.BeforePost. In my understanding, odsDetails.Cancel should be called if I call odsMaster.Cancel. Right? I cannot call it manually because odsDetails.Cancel happens before odsMaster.BeforePost event.

How should I go about this?

Thanks in advance,
Alex
 
Originally posted by Gorby:
I cannot call it manually because odsDetails.Cancel happens before odsMaster.BeforePost event.
I'm not sure I understand this particular section.

------------------
Marco Kalter
Allround Automations
 
Hi,

I screwed the things up.
smile.gif


it should be:
I cannot call it (odsDetails.CanlecUpdates) manually because odsDetails.Post happens before odsMaster.BeforeCancel event.

Again, my problem is that detail dataset with CachedUpdates=True gets posted when I call Cancel for Master dataset. Is it normal DOA behavior?

Regards,
Alex
 
I will look into this. As a workaround you would probably need to call Detail.Cancel before calling Session.CancelUpdates.

------------------
Marco Kalter
Allround Automations
 
Back
Top