Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger Usage
Message
From
17/03/2004 13:49:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
17/03/2004 07:44:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00887019
Message ID:
00887192
Views:
21
This message has been marked as the solution to the initial question of the thread.
Quite logically, the condition closep_ID = 0 checks for the new (modified) value of closep_ID being = 0. If you want to check the value of closep_ID before the user changed it, check for oldval("closep_ID") = 0.

>Hi, I think I need a better understanding of the use of Triggers.
>
>Here is the situation. I have a table of financial transactions (FINXN). When I want to close a period and "cast it in stone" I flag the FINXN records that I do not want the user to be able to change/delete. The flag is accomplished by entering a value other than 0 into an integer field in FINXN ala Finxn.closep_ID = 8.
>
>In the DBC I have two triggers on the FINXN table: Both the update and delete triggers are "closep_ID = 0"
>
>So far so good... This yields the behavior I was expecting (almost). If the closep_ID in a Finxn record is NOT 0, any attempt to delete that record or to edit any fields on that record results in a "TRIGGER FAILED" message. That is GREAT! EXCEPT that I am able to modify the closep_ID field and change it from 8 to 0 without failing the trigger. Once I have done that, of course I can then modify all of the other fields.
>
>I think that is BAD behavior but it gets more interesting... If I change the closep_ID value from 8 to 0, now I cannot change it back to 8!.
>
>What am I missing ?? Perhaps VFP looks only at the new value of closep_ID and, since it is 0, changes are allowed??
>
>Thanks,
>
>Ken
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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform