Bug? Insert query sends `null` instead of 0 when component default value is set to 0

I have a form that is inserting data into a mySQL database. The datatype is an integer, and it is a required field - set to NOT NULL in the database. The number input component on the form for this column has a default value of 0. 0 It is fairly often that the user won't need to change the number input from 0 at all, as 0 is a valid input for this case. I have tried clicking the "reset state" button and it will fix it for a couple days - but then the issue comes back for multiple users.

If the user does not change the number input at all from 0, when the insert query runs, the {{numberInput.value}} evaluates to NULL, even with the "default value" set to 0. This causes an error, since the database rejects the NULL, because of the NOT NULL constraint.

I did find a workaround however, if the user uses the stepper buttons to change the number, and then changes it BACK to 0, then the query sends the value as 0 and there is no problem.

For the time being - I've altered by DB table to use DEFAULT 0 and removed the NOT NULL constraint - but it would be nice if the "default value" worked correctly with 0 values!

Screenshot 2024-03-19 at 9.34.07 AM

Screenshot 2024-03-19 at 9.34.18 AM

Hi @mHearn,

You could try changing the value to {{ newKitMNSamples.value ?? 0 }} which will coalesce the value into a 0 if for some reason it's null. You can read more about that operator here.

Oh this is definitely a better workaround than I had - thank you!