Subject Re: [IBO] IBO detect a wrong numerics field
Author Helen Borrie
At 10:08 PM 14/12/2003 +0800, you wrote:

>Hi Helen, can you please help me with this one.

I have been trying to. It may surprise you to learn that I do not have the
power to see through walls.

> I don't have any idea
>where to start... I have tried many time using ibexpert and it work fine
>after inserting a record on counter table. Yes Helen I don't have a
>before insert trigger in suppliercredit also. In may application code, I
>dont have any code on before or after post of the ib_query.


>One thing that I think of is ... Iam sorry that I didn't mention this
>earlier, I have my counter table setup as a master table in IBO. Could
>it be that since the counter is a master table there is a postretaining
>that is happen that could affect the trigger?

Yes. The postretaining will post an initial insert for the master, that
will fire the trigger. At that point, the only column containing a value
is ID, because this initial post occurs before you even see the insert
buffer. So the trigger is creating the suppliercredit records at that
point, with ID and two constants. It doesn't have a value for amount,
because you haven't entered it yet.

Problem explained.

If you must have this table 'counter' as a master in your client app, then
you need your trigger to fire on AfterUpdate, not AfterInsert. You will
need to include some logic so your after update trigger only fires if
old.Amount is null.

Helen