timb25
21st July 2005, 15:30
We needed a way to keep history from the production planning table (tisfc010). More information than what the costing tables kept.

First I made a copy of the tisfc010 table. Then I added a sequence number field to the copy. Next, I created a trigger placed on the tisfc010 table. Upon Insert or Update of the tisfc010, I inserted a record into the copy with sequence=0. If a tisfc010 record was updated, another record was inserted into the copy table with the next sequence number. This was working very wellÂ….. However.

Whenever a date was changed on the Production Order table (tisfc001), the planning for that order disappeared in table (tisfc010). I do not write to the tisfc010 in my trigger, only read. I don't understand why this is happening. Does anyone have any suggestions? Thanks.

-Tim

gguymer
21st July 2005, 16:26
There DELETE triggers too. If a record is deleted from a table, then you can capture that record before it is deleted by using a DELETE trigger. We use a DELETE trigger to capture the records on this very table because they are deleted by Baan at a certain point in the process. Use the "OLD" value when referencing field values from the record that is to be deleted.

Gilbert Guymer
Database Administrator
Lufkin Industries, Inc.

timb25
21st July 2005, 16:53
I did not specifically write a delete trigger. But, it seems like my trigger was purposely deleting the planning table. When I disabled this trigger and performed the same exact action to the order table(tisfc001), those planning records in tisfc010 were fine. It was only when the trigger was enabled that it removed records from the tisfc010.

gguymer
21st July 2005, 18:32
Baan removes those records, and not your triggers. It was for that reason we created a delete trigger to copy the record being deleted to another table for historical purposes. The purpose of a delete trigger is to do something when a record is about to be deleted. It should not be affecting the tisfc010 table if your triggers are merely copying the record when it is inserted or updated on the tisfc010 table to another table.

Gilbert Guymer
Database Administration
Lufkin Industries, Inc.

timb25
21st July 2005, 19:13
I modified the trigger for action when those records are deleted. So now I have them in the copy of tisfc010.

However, now that these records are removed from tisfc010, Baan functionality is basically broke for the remaining production order planning procedures.

I don't know how to continue....

gguymer
21st July 2005, 19:19
Insert and Update triggers will not handle a delete action on a table. You need to create a Delete trigger for that.