Subject AfterInsert Trigger not firing properly?
Author Chuck Belanger
Hello:

I'm still very much a newby, but I have what seems to be an odd problem
with a After Insert Trigger.

I'm using IBExpert to create my triggers.

The trigger updates a table which is used in a treeview. It sets a flag
used to change the tree graphics from an "item" to a folder. A folder
image denotes that the node has children.

After Insert:
(when adding a new item to another item, that previously has no
children)

Update MasterLibrary
Set ml_Has_Children = 1
where ml_id = new.ml_parentid

ML_PARENTID is a parameter passed to the INSERT statement. There is a
Before Insert trigger which assigns the defaults to the various fields.
It works fine.

On running the above in the IB_Expert's SQL Editor, it updates as
expected.

When I deactivated the trigger and added the UPDATE code to an IB_DSQL
component in the program right after the INSERT SQL, it did not update
the table at all. (i.e. just like the Trigger). I traced the code and
the parentid in the SQL was correct.

There is an After Update Trigger with the same code and it works just
fine. (I use this when moving nodes via drag and drop.)

Thank you for any help to get this to work.

Chuck Belanger