Null values in relation

I have a form with some relation (not mandatory) with numeric foreing key, the problem is when is not select some value I get error, the empty value is converted to 0.

At the last SC release is solved this bug? because it is here many years now

regards

Marcelo

This is Old Bug. Try on event OnBeforeInsert do your validation.
if ({field1} == 0) {
{field1} = NULL;
}

Alvaro, thanks very much for your response.

Will be really hard to solve this issue?, I think the community many year waiting to solve this bug, I hope SC team say some thing.

regards

Marcelo

If I understood well, if your field is foreign key it cannot be nullable. It must have a value. So in your table, the default value must be zero.

1 Like

Why? Technically, a foreign key can be null. It is a matter of inner vs outer join, which might be mishandled.

1 Like

Thanks for yours response,

Kleyber, if the relation is not mandatory, the foreingkey can be null

In case if the relation is not mandatory ok, it can be null.

Other option for fix this bug is create a trigger for validate the zero value.

Thanks for your replies,

I think, we use SC for focused in the logic of problem (solution) not for coding, I hope SC team solve this old bug

Muchas gracias a todos