Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Update trigger for date edited
Mon, Nov 17 2008 4:44 PMPermanent Link

Dale Derix

Using ElevateDB Manager, I've created a trigger to update the DateEdited field with the
current date whenever a record is edited (updated).

On the General tab, I have Action Time set to "Before", and Type set to "Update".  The SQL
tab is as follows.

BEGIN
  SET NEWROW.ctDateEdited = CURRENT_TIMESTAMP();
END

When I edit a record (by opening the table in the ElevateDB Manager), the value of the
DateEdited field does not change.  Do I also need to set something in the Columns tab or
the Condition tab?  I want this trigger to fire anytime anything changes in the record.

Thanks.

Dale
Tue, Nov 18 2008 2:53 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dale,

<< Using ElevateDB Manager, I've created a trigger to update the DateEdited
field with the current date whenever a record is edited (updated).

On the General tab, I have Action Time set to "Before", and Type set to
"Update".  The SQL tab is as follows.

BEGIN
  SET NEWROW.ctDateEdited = CURRENT_TIMESTAMP();
END

When I edit a record (by opening the table in the ElevateDB Manager), the
value of the DateEdited field does not change.  Do I also need to set
something in the Columns tab or the Condition tab?  I want this trigger to
fire anytime anything changes in the record. >>

No, you shouldn't need to do anything else.  Could you post the actual SQL
that was generated from the SQL History window in the EDB Manager ?
(Explorer menu/SQL History item)

I tried the same thing here with 2.02 B3:

CREATE TRIGGER "TimeStampTest" BEFORE UPDATE
ON "customer"
BEGIN
  SET NEWROW.LastInvoiceDate = CURRENT_TIMESTAMP();
END

and it works fine.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Nov 18 2008 3:46 PMPermanent Link

Dale Derix

<<No, you shouldn't need to do anything else.  Could you post the actual SQL
that was generated from the SQL History window in the EDB Manager ?
(Explorer menu/SQL History item)>>


ALTER TRIGGER "OnUpdate" BEFORE UPDATE
ON "Contacts"
BEGIN
  SET NEWROW.ctDateEdited = CURRENT_TIMESTAMP();
END


I'm still using the Trial version, which is 2.02 Build 2.

Thanks,

Dale
Tue, Nov 18 2008 5:20 PMPermanent Link

Dale Derix

I'm sorry Tim.  It seems to be working now.  I hope I didn't waste too much of your time.

Dale
Wed, Nov 19 2008 2:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dale,

<< I'm sorry Tim.  It seems to be working now.  I hope I didn't waste too
much of your time. >>

You owe me 30 seconds. Smiley

I'm glad that it's working okay for you now.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image