Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update changes
Message
De
16/11/2003 12:02:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
16/11/2003 11:30:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00850424
Message ID:
00850450
Vues:
13
>thanks for your quick reply. unfortunately, i think this is exactly what i am doing. in a stored procedure, i do the following:
>
>old_field_value = oldval ('fieldname', 'tablename')
>new_field_value = fieldname &&this is the new value for the field
>
>I do this for every field in the table, and then store the old and new values each in their own field, with two fields per every field in the original table. every time there is a change to a field value in the original table, this stored procedure is triggered.
>
>I was hoping there was an easier way, as my tables have a number of different fields (which makes it time consuming to create the stored procedure and also to track down the changed field in the update table). I had read about getfieldstate() and thought this might provide me an easier way, but i have not been able to get it to work.
>
>paul

The easiest thing is to just write the loop, and compare.

I don't know whether you would get a speed advantage with GetFldState(). Perhaps yes, so here goes:

Let's say that GetFldState(-1) returns "111121". This means that the fourth field has changed. (The first digit is to track changes to the deleted() status.) Other fields haven't been modified in the example.

You can loop through this, searching for occurences of "2".

For new records, the values are 3 and 4, instead of 1 and 2.

Please note that a "1" indicates that there is no change, whereas a "2" indicates that there may be a change. If the user changes a value, say, from "a" to "b", and then back again, GetFldState() will indicate that there was a change. So, for efficient storing, you should still compare whether there have been changes.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform