How to store Null value in Database

How to store Null value in Database

  

Hi,

I am using SQL server database,

I have an nullable integer field in my database,

If i didn't specify any input in the form "0" is saved by default.

I want to store NULL instead of "0", How to do that?


Already tried to put NullIdentifier() ?

Hi,


There are no actual Nulls in OutSystems, so you can't store a null in an OutSystems Entity. (its possible only on external imported tables)

Even in just on the Form part, you have no easy way to see if it was filled or not unless you explicitly look at the input.TypedValue , since the variable will always be filled with the 0 value anyway. Usually this type of things are done with a separate checkbox instead of making the semantic "0" value being different from "". If your form is also used to edit the information that was stored, you will have a very hard time rendering both 0 and empty on the input.


The best option for the storage part is to have a separate field telling you if it was filled or not.


Regards,

João Rosado

João Rosado wrote:

Hi,


There are no actual Nulls in OutSystems, so you can't store a null in an OutSystems Entity. (its possible only on external imported tables)

Even in just on the Form part, you have no easy way to see if it was filled or not unless you explicitly look at the input.TypedValue , since the variable will always be filled with the 0 value anyway. Usually this type of things are done with a separate checkbox instead of making the semantic "0" value being different from "". If your form is also used to edit the information that was stored, you will have a very hard time rendering both 0 and empty on the input.


The best option for the storage part is to have a separate field telling you if it was filled or not.


Regards,

João Rosado

Hi João,

I am using external database in my application, when i submit a form 0 is stored by default instead of zero.

How to set Null value instead of 0?





Solution

In Integration studio in your entity there is a "Default Value behavior" combo box.

Here is a link for the documentation. It converts the default values of optional attributes to null.


Regards,
João Rosado

Solution

Thanks João, Its working fine 

João Rosado wrote:

In Integration studio in your entity there is a "Default Value behavior" combo box.

Here is a link for the documentation. It converts the default values of optional attributes to null.


Regards,
João Rosado