Board index » delphi » why does IB insist null field must be NOT null

why does IB insist null field must be NOT null

I have a field in a table called Generation which holds the suffix for
a name such as Jr, Sr, III, etc.  I also have a domain NRQ_GEN as
follows:
CREATE DOMAIN NRQ_GEN AS VARCHAR(3);

The table is created as follows:
CREATE TABLE PTINFO (...
        GENERATION   NRQ_GEN,

I am getting the error message, "Record or Field Constraint Failed
VALUE IS NOT NULL" when I try to post the data to the TTable whenever
this field is empty.  However, the all of the data will save and I
don't get this message if I put in a suffix such as Jr in this field.

I've tried the following:

1.) I've already checked that the TField's required property was set
to False (it was).

2.) The field name was originally GEN, but I changed it to GENERATION
and then again to GEN_CODE just in case it conflicts with a required
IB name such as GENERATOR.

3.) I originally had an index on Last, First, Mid, Generation, then
dropped the index and recreated a new one on Last, First, Mid in case
these indexes don't allow NULL fields - this was a secondary index so
I don't know why this would be the case.

4.) I recreated the database again in case there were traces left of a
conflict in the original database from 1 or 2 above.

5.) I renamed the DisplayLabel from Gen to Gen Cd, again in case there
was some unknown conflict.

6.) I had a calculated NAME field using First + Mid + Last + Gen.  I
changed the logic to only add Gen if not IsNull, in case the
calculated field was in conflict.

I've spent 2 days on this problem, and have run out of ideas.  Does
anyone have any other suggestions as to why IB will insist that this
field must be NOT NULL even though it is definitely NOT defined as
such.

Jim

 

Re:why does IB insist null field must be NOT null


Quote
> I am getting the error message, "Record or Field Constraint Failed
> VALUE IS NOT NULL" when I try to post the data to the TTable whenever
> this field is empty.  However, the all of the data will save and I
> don't get this message if I put in a suffix such as Jr in this field.

Changing the Tfield parameter "required" to false makes it go away. In
your before post method, just put a 1 in for the key field and let the
generator overwrite it.

Or you can do what most people do, put down a TStoredProc ... connect it
to a stored procedure on your IB server that returns the next value of
the generator. Put the value returned from the TStoredProc into your key
field and post.

hth

Robert Schieck (TeamB)
http://www.mers.com

Re:why does IB insist null field must be NOT null


Quote
>Changing the Tfield parameter "required" to false makes it go away. In
>your before post method, just put a 1 in for the key field and let the
>generator overwrite it.
> Robert Shieck

Sorry to bother you Robert, but the problem I am having is apparently
not related to the generator field in my previous questions.  The
generator apparently works if this additional field (now called
Gen_Code) is filled and not null, and doesn't work if it is not filled
in.

This other field is a String field that is NOT connected to a
generator, and is definitely NOT set up as NOT NULL in the database,
but IB is apparently requiring it.

Do you have any other ideas?

Jim

Re:why does IB insist null field must be NOT null


Hi Jim,

Here I am once again.

Couldn't you check to see if that field isn't required by some other table.
Maybe you set up a relation in another table which requires this field.

Possibly this isn't the case, but that's the only thing I can think of right
now.

Greetings and best regards,

Stefaan Lesage
Fotek nv; Belgium
Stef...@fotek.com

Quote
Jim Orlowski wrote in message <3459b610.2229...@forums.borland.com>...
>>Changing the Tfield parameter "required" to false makes it go away. In
>>your before post method, just put a 1 in for the key field and let the
>>generator overwrite it.

>> Robert Shieck

>Sorry to bother you Robert, but the problem I am having is apparently
>not related to the generator field in my previous questions.  The
>generator apparently works if this additional field (now called
>Gen_Code) is filled and not null, and doesn't work if it is not filled
>in.

>This other field is a String field that is NOT connected to a
>generator, and is definitely NOT set up as NOT NULL in the database,
>but IB is apparently requiring it.

>Do you have any other ideas?

>Jim

Other Threads