Subject Re: [IBO] Re :Re: Before Post event not triggered
Author Jason Wharton
TDataset has the CheckRequired before the BeforePost event. Thus, if you
have a required column NULL you will not get to the BeforePost event but
instead have an exception.

procedure TDataSet.Post;
begin
UpdateRecord;
case State of
dsEdit, dsInsert:
begin
DataEvent(deCheckBrowseMode, 0);
CheckRequiredFields;
DoBeforePost;
CheckOperation(InternalPost, FOnPostError);
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
DoAfterPost;
end;
end;
end;

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


""Artur Anjos"" <arsoft@...> wrote in message
news:000b01c1526c$9c15bb20$0200a8c0@......
> I don't use tables, but this problem is on Before Post: your table assumes
=
> this field (Customer) as required, so it must have a value before the
post.
>
> What you can do: use a OnNewRecord to give Customer a value. If your
trigge=
> r checks Customer, use a value that could not exists on Customer Table.
Nex=
> t, you must Refresh the row after post, to get the value back into your
app=
> lication.=20
>
> Remember this: IBOTable should validate the values before post - it must
be=
> this way to act just as the BDE does.
>
> Regards,
>
> Artur Trindade Anjos
> http://www.arsoft.pt
>
> ----- Original Message -----=20
> From: Helen Borrie=20
> To: IBObjects@yahoogroups.com=20
> Sent: Thursday, October 11, 2001 8:58 AM
> Subject: Re: [IBO] Re :Re: Before Post event not triggered
>
>
> At 07:47 AM 11-10-01 +0000, you wrote:
> >When it comes to the line customer.post, an f7 step in goes to the=20
> >tibodataset post procedure, rather than the before post. At the line
> >'inherited Post;' I get the error 'field customer must have a
value'.=20
> >The customer field is assigned in the before post event.
>
> OK....that does seem wrong to me, too. (I _never_ use tables so I have
n=
> ot bumped into it.)
>
> For assigning a primary key, use GeneratorLinks if you are using a
genera=
> tor; or put your routine to calculate a PK into the BeforeInsert handler.
=
> BeforePost is not the right place to do it, anyway, because you don't
want=
> this code to fire on updates or deletes.
>
> As for intercepting Post errors and exercising a cancel (or abort)
option=
> on invalid data, the OnPostError event might serve your purposes better.
=
> Even better would be to put your error handlers into the TIBODatabase's
OnE=
> rror handler - that way you don't have to worry about it on your
individual=
> datasets.
>
> regards,
> Helen
>
>
>
> >=20=20
> >--- In IBObjects@y..., Helen Borrie <helebor@d...> wrote:
> > > At 07:25 AM 11-10-01 +0000, you wrote:
> > > >Hi
> > > >
> > > >I have done a conversion from ttables to tibotables. My ttables=20
> >had=20
> > > >before_post events. When doing a post with tibotable, the=20
> >ibodataset -
> > > > tibodataset.post procedure kicks in and does the post. Hence
my=20
> > > >before post event does not happen - In certain cases this is
where=20
> >I=20
> > > >decide to assign the key field value (required) / or cancel the=20
> > > >record.=20
> > >=20
> > > What makes you think BeforePost is not firing?
> > >=20
> > > Helen
> > >=20
> > >=20
> > >=20
> > > >What to do ??
> > > >
> > > >
> > > >
> > > >=20=20
> > > >
> > > >Your use of Yahoo! Groups is subject to=20
> >http://docs.yahoo.com/info/terms/=20
> > >=20
> > > All for Open and Open for All=20
> > > InterBase Developer Initiative =B7 http://www.interbase2000.org
> > > _______________________________________________________
> >
> >
> >
> >=20=20
> >
> >Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms=
> /=20
>
> All for Open and Open for All=20
> InterBase Developer Initiative =B7 http://www.interbase2000.org
> _______________________________________________________
>
> Yahoo! Groups Sponsor=20
> =20=20=20=20=20=20=20
> =20=20=20=20=20=20=20
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.=20
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> =20
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/=20
>
>
>