Subject | Re: [IBO] Re :Re: Before Post event not triggered |
---|---|
Author | Artur Anjos |
Post date | 2001-10-11T15:51:36Z |
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 trigger checks Customer, use a value that could not exists on Customer Table. Next, you must Refresh the row after post, to get the value back into your application.
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
What you can do: use a OnNewRecord to give Customer a value. If your trigger checks Customer, use a value that could not exists on Customer Table. Next, you must Refresh the row after post, to get the value back into your application.
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 -----
From: Helen Borrie
To: IBObjects@yahoogroups.com
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
>tibodataset post procedure, rather than the before post. At the line
>'inherited Post;' I get the error 'field customer must have a value'.
>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 not bumped into it.)
For assigning a primary key, use GeneratorLinks if you are using a generator; 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 OnError handler - that way you don't have to worry about it on your individual datasets.
regards,
Helen
>
>--- 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
>had
> > >before_post events. When doing a post with tibotable, the
>ibodataset -
> > > tibodataset.post procedure kicks in and does the post. Hence my
> > >before post event does not happen - In certain cases this is where
>I
> > >decide to assign the key field value (required) / or cancel the
> > >record.
> >
> > What makes you think BeforePost is not firing?
> >
> > Helen
> >
> >
> >
> > >What to do ??
> > >
> > >
> > >
> > >
> > >
> > >Your use of Yahoo! Groups is subject to
>http://docs.yahoo.com/info/terms/
> >
> > All for Open and Open for All
> > InterBase Developer Initiative · http://www.interbase2000.org
> > _______________________________________________________
>
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
All for Open and Open for All
InterBase Developer Initiative · http://www.interbase2000.org
_______________________________________________________
Yahoo! Groups Sponsor
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]