Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread AfterDelete trigger - CurrentRecord empty?
Fri, Oct 12 2007 11:47 AMPermanent Link

Chris Erdal
I'm getting more and more organised, and am moving bits of code from all
over the place to database triggers, which I see as a GOOD THING !

In the afterDelete trigger I'd like to recalculate some totals in the
Master table when a Detail row is deleted, but when I use the CurrentRecord
fields as I already do in the AfterInsert/AfterUpdate triggers, the field
values are empty.

Is this my fault, or is a parameter with a load of empty fields really sent
with the event handler?

If the latter, I suppose I can always use the BeforeDelete trigger instead,
inside a transaction, but would it be possible to send the values of the
just-deleted fields instead?

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Fri, Oct 12 2007 6:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Chris,

<< Is this my fault, or is a parameter with a load of empty fields really
sent with the event handler? >>

Use the TField.OldValue property for the TFields when you access them via
the CurrentRecord object.  Since the row was deleted, there really is no
"current" value.

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, Oct 14 2007 8:58 AMPermanent Link

Chris Erdal
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in
news:A7691509-F221-4A64-8F37-59F6A456150D@news.elevatesoft.com:

><< Is this my fault, or is a parameter with a load of empty fields
>really
> sent with the event handler? >>
>
> Use the TField.OldValue property for the TFields when you access them
> via the CurrentRecord object.  Since the row was deleted, there really
> is no "current" value.

Do-o-oh.

Things are so self-evident, once someone's explained them to you ...

Thanks!

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Image