Subject [IBO] Re: IB_Query remains in EditMode after Posting
Author andygarneruk
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 11:39 PM 15/02/2004 +0000, you wrote:
> >--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> > > At 02:26 PM 15/02/2004 +0000, you wrote:
> > > >I am attempting a secondary update to a dataset in its
AfterPost
> > > >event.
> > >
> > > Why?
> > >
> > > Helen
> >
> >The dataset is a master (sales order) with two details (1=order
> >items; 2=percentage commission payable to agents). When, for
example,
> >an additional item is added to the order, the order value (stored
in
> >the header) changes. The commission due to each agent then needs to
> >be re-calculated, and the total reflected in the margin (=total
sales
> >value less total costs, less total commission) - these totals are
> >also stored in the master.
> >
> >I detect a change to any of the totals in the BeforePost of the
> >master, and hoped to use this to trigger a re-calclation of the
> >others in the master's AfterPost.
>
> So - are these calculated fields in the app? or are they computed
or
> run-time columns from the database?
>
> It matters...if they are calculated (and not stored in the
database) then
> you shouldn't be trying to push them into the Post event at all
(before or
> after).
>
> Helen
> >


There are no calculated or computed fields - they are all database
fields defined in the master table. At the moment I think the reason
the secondary update (from within AfterPost) fails is a problem with
IBO (or perhaps the design of my app).

The core of TIB_Dataset.SysPost is essentially:

1 if not IsPosting
try
2 IsPosting := True;
3 SysBeforePost;
4 SysExecPost;
5 SysUpdateState
6 SysAfterPost;
finally
7 IsPosting := False
end;

When the AfterPost event is invoked at line 6, IBO still has the
dataset as 'IsPosting'. Hence the secondary update attempt (from
within the AfterPost event) is forestalled at line 1, even though the
dataset's state is then dssBrowse (line 5).

Best regards, Andy.