Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update Timestamp
Message
De
03/09/2015 04:22:21
 
 
À
03/09/2015 04:16:14
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01624207
Message ID:
01624220
Vues:
53
>>>>>>Hi All,
>>>>>>
>>>>>>This is going to sound real stupid. Sorry. How do I set up a field in a table so that every time a record is updated, this field is updated with the current date/time?
>>>>>>
>>>>>>Also, I need for this to work in VFP 5.0 as well.
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>Yossi
>>>>>
>>>>>In addition to Naomis reply. Note that the timestamp will be that of the local machine.
>>>>>
>>>>>An update trigger will do the job, but you need a database to wrap your tables
>>>>>This will work from inside VFP only
>>>>
>>>>Please excuse my ignorance, but how does the update trigger accomplish what I want. It's asking for a logical expression.
>>>
>>>No problem, I have to lookup the help myself. I've done such stuff through my framework, so I'm not an expert here.
>>>from
>>>
HELP CREATE TRIGGER
>>>[snip]
>>>Specifies the logical expression evaluated when the trigger occurs. lExpression can be a user-defined function or a stored procedure that returns a logical value.
>>>
[/snip]
>>>
>>>you create a function in the database (aka stored procedure)
>>>parameter is table name
>>>this fundtion replaces datetime value
>>>and create logical return value
>>>
>>>HTH
>>
>>
>>As far as I know, a trigger cannot replace anything in the record that caused it to fire
>>You'll have to use a table rule
>
>Thank you. So you do this in record validation?

Yes

(1) You have find out which fields may have changed ( getfldState)

(2) Then for each field that may have changed - test whether it has actually changed

>I know there was a reason to do this in the CA's. I hate those VFP database container stuff.

I have made my own relational integrity - done a lot with triggers
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform