Subject Re: [IBO] Foreign Key Constraint Exception Handling in Datagrid
Author kudapucat
> Tib_Datagrid? auto update feature?
IB_Grid I meant, apologies, I was tired and annoyed :-)
Also I was referring to the manual data entry feature of the grid.
>
> >I want to catch the exception raised when a foreign key constraint
> >is violated. How can I do this? I have discovered the onError
> >function of the TIB_Query, and I and instruct the exception not
the
> >be raised by setting the RaiseException variable to be false,
>
> Well, killing the messenger doesn't solve the problem...
> >however the proceedure will then continue be cause the exception
> >wasn't caught it was just silenced.
>
> If you silence an exception, it doesn't cause the error to be
fixed by
> magic. The idea is NOT to kill the exception but to *catch* it and
provide
> the user with the opportunity to fix it.

It is my intention to catch the error, however I am not sure how to
go about
this.

> Whatever happens, the server isn't going to allow you to post a
record
that
> causes a foreign key violation. The purpose of exceptions is to
signal
> that fact to the application. So, if your application provides
users with
> the ability to create FK violations then it must "listen" for this
> exception and provide a solution.

FK Violations are conventionally unallowed, what I wish to allow the
user to
do is to update the FK if necessary to add a new part. I intend to
have a
cascading input so that a new part can be added and each FK
Violation caught
and allow the user to update the FK table so as to have no
violations. It
has occured to me, that most of the operators at the place I work
have
difficulty when adding a new item, because they must start with
making sure
all the new parts are added before the new sub-assemblies are added
and
before the new item is added. This seems backwards for them, and
with the
complex item-subassembly-part relationship and the sheer number of
parts per
subassemblies and subassemblies per item, invariably the user misses
some
parts, causing a FK violation that he must sort out himself by
adding the
correct key. I intend to implement something simmilar to Quicken's
drop
down boxes and offers to update the FK to erase the violation.

> The detail of that solution I cannot suggest, not knowing what the
> application is doing that permits the exception to occur...
>
> Helen
>

I apologise for the lack of detail in my original post and I thank
you for
you quick reply.
Hamish Lucas

PS My apologies for the late reply, but I did send this a week ago,
as it is not on the msg board, I am assuming it somehow encountered
an error.