Doug, I have used the NOCALC switch before and works as advertised. Having said that, I would be hesitant to use a computed field that uses the #NOW variable since it is dynamic and I would rather have that columns locked on one date and not take a chance of it updating when not wanted. Have you consider using the After Insert trigger with something like this:
UPDATE ShipmentTracking + SET TrackingDateTimeAdded = .#NOW + WHERE TrackingDateTimeAdded IS NULL It would automatically update anything that does not have data which most of the time would be only the record just inserted. Jests a though and I have not looked into any undesirable side effects. Javier, Javier Valencia, PE 913-915-3137 -----Original Message----- From: [email protected] <[email protected]> On Behalf Of Doug Hamilton Sent: Tuesday, September 28, 2021 10:43 AM To: R:Base List <[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]. 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/!%26!AAAAAAAAAAAYAAAAAAAAAG1gU%2BA71stIig71BAFnx9iihQAAEAAAAEH4%2BR0fIvFMtLO8fsISh/8BAAAAAA%3D%3D%40vtgonline.com.

