Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to know if someone changed one or more fields
Message
De
26/03/2024 07:20:56
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
26/03/2024 06:49:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01687771
Message ID:
01687773
Vues:
57
J'aime (1)
>>Is there a way for user "A" to know if any other user modified the same record (the same or other fields), and for the application to know and notify the user of those changes? Then, user "A" decides whether or not to overwrite those previous changes.
>
>Check out these functions: GetNextModified(), GetFldState(), CURVAL(), and OLDVAL()

Not sure oldval() would be enough, these functions compare the edited values against the last read values. The problem in this case is the value at the server, which is unknown at save time. One possible solution would be to have the wheretype=1 (if I remember correctly*), the one which compares not only the key against the serverside record, but also the oldval() values against it. So if the old value of the field is not the same as the value on server, the update will fail... and that's where it gets complicated, what to do then. One way would be to retrieve the record in its current state from the server into a separate cursor, then show the differences between it and the values we tried to save (ouch, lots of code to write), show them onscreen (more code...) and let the user decide what to do. If it's a text field, try to merge perhaps (ouch squared).

* nope, it's 3
3 or DB_KEYANDMODIFIED (from FOXPRO.H) - Includes the primary fields specified by the KeyFieldList property and other modified fields.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform