Updating a field to null before insert or update on a from app

I’ve the next problem: I have a form app with a field called id_cc that is created as a select field. This select field has a default value for not set id, (null). When I update the form by keeping the id_cc as the default value, it tries to insert as 0, so it fails due the constrain in database. I’ve forced in the onBeforeUpdate, onBeforeInsert and onValidate to be null but still doesn’t works, always tries to insert as 0, so the query fails with the appropiate error message.

{id_cc} = NULL;

How can force the value to be null?

That Bug was reported for Me and other users, But SC team do not fix it. Please This error Need be Fix it.
A temporal solution is create a trigger and validate IF = 0 THEN NULL.

Thank you very much. I’ve sent the bug yesterday, but SC team has not responded yet. Hope we had luck in the future and they solve this…

Good morning, I have the same problem on the management of a number field.
I summarize the situation and scenarios.
DB - Oracle
Numeric field name : Azimut.
Allowed values 0 to 359.
The field is not required.

  1. Field Setup in case of no enhancement. I set null
    If I enter the field value of 0 on the database stores null (verified on table ).
    This is not good because the field can take the value 0.

  2. Field Setup in case of no enhancement. No setting
    If I enter the field value of 0 on the database stores 0, verified, it would be fine.
    If the field does not I enter anything on the database stores equally 0, occurred, not good, it should leave it blank.
    As I said the field is not required, so may seem enhanced.

I do not know how to solve it, unfortunately a variable is considered empty if it is:
? empty string;
? numerical value of 0;
? array with no elements;


Hello, I’m updating the scriptcase version but do not yet solve my problem.
My problem is how to handle a numeric field that can take the values 0, blank or greater than 0. The field is not mandatory.
AIso I saw in the forum that the problem had already been reported but has not been solved yet.
For me it is very important.
Thank you

Please SC TEAM We need solve this Bug. It is old Bug.!

I opened a ticket. They admitted that it is a bug. Still do not resolve. I’m losing hope. For me it is very important.
For my situation I was unable to find an interim solution.
Thank Alvagar

I think you can create a listbox with the values (-1 to 359) and you can validate in if value = -1 then null.

Thank very much for your support Alvagar.
Unfortunately is a problem that in general on the numeric and decimal fields.
I have to be able to input the data because there are too many variations.
The problem is not imposed only if no value, scripcase puts the value 0.
The field must remain empty because for me 0 is a useful value.

Your issue sound similar to what I have experienced. However, I managed to get a null inserted. My field refers to a category, and I wanted the user to select nothing in some cases. In the beginning I got the foreign key constraint error when I update the field to null, since it does change the null to a zero in the backend. I use a UNION select to populate the dropdown, and add an empty option with null as internal value.

Then I looked at the option of the field called “Database value” within the scriptcase editor. On there I set both options below it to null, and it worked when I set the field to null.

This worked on MySQL.

[SOLVED] I don’t know why, by I’ve solved by settings the initial value to “NULL” (without quotes), in the Lookup settings in the Title internal value input text.

Unfortunately my problem is unresolved.
My problem is how to handle a numeric field that can take the values 0, blank or greater than 0. The field is not mandatory.
the problem that 0 and null are considered equal. For me 0 is a valid value, while null means not valued.

I think you can SET the datatype from Numeric to Varchar. and do a validate for the field with only numbers and Point.

Hello Alvagar!
After the last release works all right.

i have an BLOB Field which i want to set NULL. I do:

  • default Value on Insert and Update = NULL => Then the field ist empty, not null.
  • In Before Insert i set {myField} = NULL; => Then the field contains the string 'null'.
What i do wrong? Or is the Bug not fixed for "Image => Database" Fields?

Best regards

The operations you perform are the same that I do.
I tested only on numbers. With the latest version works well, finally.
For me it was very important. Ask the question to the scriptcase team.
Thank you