Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Year 0000
Message
 
 
À
15/04/2005 12:37:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01003937
Message ID:
01005198
Vues:
25
>Nadya, without known what do FieldChanged() is impossible simplify the logic;
>I can simplify the syntax, but the logic still the same:
>
>STORE GETFLDSTATE(-1)	TO row_State
>FOR iField=RAT('2',m.row_State)-1 TO 1 STEP -1
>   IF FieldChanged(FIELD(m.lnPos)) ;
>     AND !INLIST(UPPER(FIELD(m.lnPos)), UPPER("cLast_Updated_User"), ; && remove upper, VFP is not C !
>				UPPER("tLast_Updated_Date"))
>       REPLACE cLast_Updated_User WITH ;
>         IIF(VARTYPE(m.gcUserID) == "C", m.gcUseriID, getuserid()), ;
>              tLast_Updated_Date WITH DATETIME()
>       EXIT
>   ENDIF
>   STORE RAT('2',LEFT(m.row_State,m.iField))	TO iField
>NEXT
>
Yes, that's basically the same. I try to avoid EXIT command, if possible. I think, my version is slightly more readable...
Ok, I guess there is no simple way to get all changed fields in one command [I was thinking about some clever chrtran implementation here]

I'll try to explain the problem I'm having.

In my table I have a table rule called UpdateUserAndTime and a trigger called _ri_handler("UPDATE"). First fires the table rule. Here I check for fields which were modified and if I find that it's a true modification (e.g. not the same value put in the field) I replace LastUpdateUser and time fields and don't check for the rest of the fields. Then the trigger code fires. At the top it would be nice to check, if either of PK or FK fields are changed (since these are the fields participating in relations). If none of these fields changed, I don't need to execute the rest of the trigger's code. So, what do you think? How can I save myself from executing code twice?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform