General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>>>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
>>>
>>>Ken,
>>>To me what's strange is that you say you can change from 0 to 8. Are you sure you can ?
>>>Cetin
>>
>>Hi Cetin,
>>
>>Yes, that is the first bad! Absolutely I can change it. Perhaps something to do with buffering wherein VFP looks only at the record in the buffer, sees that it is now 0 ?? But that would not explain the inabililty to change from 0 back to 8.
>>
>>Thanks,
>>
>>Ken
>
>But with buffered data triggers wouldn't fire till tableupdate(). Maybe you're misinterpreting the change thinking it has changed ?
>Cetin
No. I actually wanted to change a bad date field on the record. I was not permitted to make that change (TRIGGER FAILED). OK so on a hunch, I tried to change the pclose_ID field on the same record. I was allowed to do so. Then I changed the bad date field successfully. But now I cannot change the pclose_ID from 0 to 8. I have closed the table and the database. Opening again reveals the date has changed and the closep_ID is 0 but I still cannot change it.
Thanks,
Ken
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only