You can set it in the default for the table column


[cid:[email protected]]



Dan Goldberg



-----Original Message-----
From: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> On Behalf Of Doug 
Hamilton
Sent: Tuesday, September 28, 2021 8:43 AM
To: R:Base List <[email protected]<mailto:[email protected]>>
Subject: [RBASE-L] - Automatic DateTime for each row inserted



I have a 7 column table, one column is named TrackingDateTimeAdded, type 
DateTime.



What's the best way to update TrackingDateTimeAdded when a row is inserted into 
the table?  The DateTime needs to persist through an UNLOAD and INPUT.



Some of these rows will be inserted by a third party via SATTACH, so it needs 
to be automated via a trigger or computed column.



I tried an After Insert trigger with the Stored Procedure:

UPDATE ShipmentTracking +

  SET TrackingDateTimeAdded = .#NOW +

 WHERE COUNT=INSERT



This updated the DateTime of the previously inserted row.

In a multi-user environment, COUNT = LAST may not update the row inserted by 
the user.

The results using a trigger were too unpredictable to be used in production.



A computed column using

(IFNULL(TrackingDateTimeAdded,.#NOW,TrackingDateTimeAdded)) works until the 
database is UNOADED and INPUTted - the column then gets set to the DateTime of 
the input.



TIA

Doug

RB X.5E 20812



--

This email has been checked for viruses by Avast antivirus software.

https://www.avast.com/antivirus



--

For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php

---

You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.

To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/0add1034-f377-c9e3-2183-d0027a6e6859%40wi.rr.com.


-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/2E4830CEC16615458329D3D83342F8D0014E9F63CD%40EXCHANGE10.

Reply via email to