Subject Re: clearing comboBox in grid does not produce NULL
Author scronkey
Thanks for the reply,

After further investigation, I have realised that it IS setting the
field to NULL when I clear the combobox.

The only way to detect it though, is through
IF (new.STK_ID IS NULL) THEN
...

But why doesn't IF (old.STK_ID <> new.STK_ID) THEN

work?

I don't really want to explicitly test for NULL, I just want to
react when the value changes.
And going from a value to NULL, to my knowledge, is a change.
But it is not being picked up like this.

Any ideas why IF (new.STK_ID IS NULL) works, but the other option
does not?

Is it because, like you said, NULL is a state not a value, and you
cannot compare a value with a state?

Is my only option to explicitly test for NULL first?

-Ryan


> It's "known" but not a "problem". It is the way null
behaves "null is a
> state, not a value". The lookup dataset has to have a unique key
and, of
> course, NULL cannot be a unique key, since it is not a value.
i.e. a null
> lookup key will NOT keylink to a null polling key, since null=null
always
> evaluates to False.
>
> If you need to enable the use of the lookup-keysource relationship
to set
> the polling key to null, then you need to include a non-null dummy
key in
> the lookup set that will map to a non-null value (a dummy
representing
> "null") in the polling column. Then, in your Before Insert and
Before
> Update triggers, you detect this dummy value and set the column to
> null. For an integer key, I usually use -1; for a character key,
I use
> '*'...but it can be whatever you need it to be.
>
> Helen