Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date of Last Update Field...
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00362891
Message ID:
00363199
Views:
16
>What is the easiest way to populate a Date of Last Update field with the current date if the value for ANY other field has changed? I am using table buffered views. I believe this eliminates the use of Update Trigger.

Hi Mark,

If the table is part of a Database, it could be easily done. Create a stored procedure or program and on Table level call this function. I've done this (after asking similar question here :) and now leave happy. Here is my SP.
Be aware, that it will change all records in the table, when you place it first time, unless you add some logic to prevent it.
Function UpdateModidate
local ldDateTime
ldDateTime=datetime()
replace modidate with ldDateTime
return .t.

Function UpdateUserID
local lcUserID
if type('oJC')='O' && Job Control is already instantiated
     lcUserID=oJC.UserID
else
    lcUserID=''     
endif    
if !empty(lcUserID)
     replace UserID with lcUserID 
endif     
return .t.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform