Subject Re: [IBO] OnAfterCommit event / OnAfterPost event
Author G. Nau
Am 30 Apr 2007 um 22:42 hat Helen Borrie geschrieben:
> It depends what you want to do. AfterPost occurs while the
> transaction is still uncommitted. It is a dataset method.
That's what I already thought so I moved it to IB_Transaction.onaftercommit.

>
> AfterCommit is a notification event that occurs after Commit was
> called from the client. It has no context at dataset level if the
> transaction is in Autocommit mode, since this causes the transaction
> to commit as soon as any dataset's Post succeeds.
That's what I expected. Autocommit and OnAfterCommit do not play nice
together.

> Could you explain what this extra statement does? With your
> transaction in Autocommit mode, if it was applicable to database
> state *before* the dataset Post occurred, it will be out of date by
> the time the dataset's work has been Posted and the transaction committed.
> On face value, it seems like something you should be doing on the
> database side, in an After trigger.
Doing a trigger is difficult, as there is some Delphi stuff to do.
To explain what should be done in the application:
*It a program to manage parts in a stock
*the parts table contains a field "autolabelprintonnewprice"
So when a user is editing the part data and the price is changed and the
autolabelprintonnewprice=1 then
a.) a label should be printed by fastreport
b.) if the label is successfully printed (user has not pressed cancel in the
print dialog nor any printing error occured), then the fields "lastlabeldate"
and "lastlabelprice" should be set to the actual values.
Part b.) is an update-sql, which is send to the database in Fastreports
OnafterPrint event.

So my question is: where do I have to start the delphi procedure? which is
-checking if a label has to be printed
-start the fastreport label printing form (which is doing the table update after
successful print)

Regards
Gunther