Convert to/from NULL value in Database

hi there, I use external mysql and in the Integration Studio find this feature:

I am wondering what the "Convert to/from NULL value in Database" means? 

I try to insert -99999999 and it is inserted as NULL in db - as I guess, not 0 (Outsystems null).

Then i open entity of that table in the outsystems, it shows 0, NOT -9999999 that I guess, because the  phrase above said to/from null, so i guess it will results -999999999. Is it correct behavior or else?

many thanks

Hi Box,

In OutSystems, the value will never be NULL, even if when you save the data in the external entity, it saves NULL.
Inn OutSystems, an integer that in DB is NULL will be read as 0, a NULL string as an empty string "", a NULL boolean as False, and so on.


EDIT. By the way, I don't think the extension is able to make a conversion FROM text to DECIMAL, implicitly (never tried). So, It seems to me that the problem of not saving -99999999 can be the fact that you are defining a default value as text when the original data type is decimal...

Hi Edu,

Thank you. So i misundertand that phrase  "Default Value behaviour: Convert to/from NULL value in Database" , i am thinking when it is saved NULL to database (Convert to-correct as i guess), when i read it back in the Outsystems, it will be the default value (-999999999 Convert from - incorrect what i guess).



When saving a record, if you don't provide a value, it will save NULL, instead of the data type default value.
When reading a field that has NULL, it will convert back.

Normally, if you don't set this, OutSystems will use the default value as value if you don't provide one.


But the behavior is not like that..when i read that null, it returns 0, instead of -9999999

Hi Box,

This is from documentation:

Indicates how the default values of the entity's attributes are stored in the database and retrieved from the database:

No conversion to/from Database : all the entity's attributes that have the default value set are stored in and retrieved from the database without any conversion, i.e., it is the default value that is stored in and retrieved from the database.

Convert to/from Null value in Database
: all the entity's attributes that have the default value set are stored in the database with the null value. When retrieving data from the database, the null value is converted to the attribute's default value. If no default value is defined for the attribute,  the null value is then converted to the Platform default value for the data type.

So, if you set Convert to/from Null value, when reading a record that has a NULL, it should come with the default value defined, OR with the datatype default value.

I just tested, in a situation very similar to yours, and it is working as expected.
For NULL values, it is bringing back the default value defined.

Could be the case that you changed the option later and that the value in the record is NOT null, but 0?

Thank you fo the document Sir. I'll retry later to validate the document.. i m using external db mysql..and after insert -999999999 in the db it becomes null db. Then i use aggregate to see that row.. is 0.. but i ll retry.. 

Hi Sir,


I have retried, just insert the value -99999 using createEntity, 

it is saved as NULL in the physical table (as i guess):

However, when i see the row in an entity, the result is NOT as expected, instead of -99999, it gives null:


I have a similar problem providing False value to a Boolean entity attribute and saving that entity in external Oracle db. When I assign True value to this attribute, it will be stored as 1 which is normal for Oracle, but False value is somehow converted to Null, which makes using that attribute in boolean comparisons... uhm... a bit discouraging: 

"isActive" = False

"isActive = True"  = false

"isActive = False" = false !!

"isActive = isActive" = false !!!

Even comparison with itself will give you False! OK, this is normal for "undefined", NaNs and etc., but a have a Boolean value.

BTW, When you see 0 in OutSystems, it may be a way of OutSystems to treat NULL value or Integer field, to be sure, compare this value to '0', and if you see False, it may mean that you actually deal with NULL value, not 0.

Hi Yuri,

Did you check the "mandatory" checkbox?

Kilian Hekhuis wrote:

Hi Yuri,

Did you check the "mandatory" checkbox?

Do you mean the scenario, when there is non-mandatory boolean field with no default value provided, and I create an entity and save it without toggling that field`s value? This make sence: if I didn`t provide the value, it may be null by default and therefore will be saved as Null (right?). I cannot be sure that I`ve tried it, unfortunately I don`t have access to the extention which handles the Outsystems-to-Oracle bridge at the time, but I`ll try it in the future to make sure this is the case. Thanks for the idea :)


First I`ve tried to assign False to isActive of existing entity and saved it. Result is NULL value in db. So that`s not the case of having not-determined value in entity, that`s a case of Outsystems converting False value to Null when trying to insert it into a bit field, and that only happens when Default Value Behavior is set to "Convert to/from NULL value in Database"

What I meant is the Mandatory Property of the Attribute:

It's currently not set, and I was wondering whether there would still be NULL values in case it's set.