Subject | Re: [IBO] Re :Re: Before Post event not triggered |
---|---|
Author | Jason Wharton |
Post date | 2001-10-12T07:23:30Z |
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@......
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 thepost.
>trigge=
> What you can do: use a OnNewRecord to give Customer a value. If your
> 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 yourapp=
> lication.=20be=
>
> Remember this: IBOTable should validate the values before post - it must
> this way to act just as the BDE does.value'.=20
>
> 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
> >The customer field is assigned in the before post event.n=
>
> OK....that does seem wrong to me, too. (I _never_ use tables so I have
> ot bumped into it.)genera=
>
> For assigning a primary key, use GeneratorLinks if you are using a
> 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'twant=
> this code to fire on updates or deletes.option=
>
> As for intercepting Post errors and exercising a cancel (or abort)
> on invalid data, the OnPostError event might serve your purposes better.=
> Even better would be to put your error handlers into the TIBODatabase'sOnE=
> rror handler - that way you don't have to worry about it on yourindividual=
> datasets.my=20
>
> 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
> > > >before post event does not happen - In certain cases this iswhere=20
> >I=20http://docs.yahoo.com/info/terms=
> > > >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
> /=20http://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
>
>
>