Mandatory attributes

Mandatory attributes

  
I have some questions about mandatory attributes.
1.Why isn't Outsystems changing the mandatory attribute on the interfaces to mandatory when the attribute is set to mandatory in the data tab?
2. Why is it possible to insert a record into the database with an empty value while the attribute is set to mandatory in the data tab?
Strange thing indeed.

I thought it used to give "boom" when entering nullidentifiers in mandatory-attributes and then inserting them in the database.
but currently i need to check it programmatically for some reason...


Solution
according to the help:
=============================================

The 'Is Mandatory' property does not create a constraint on the database. Database constraints are only created for primary keys and reference attributes.

 

If true, Platform Server validates, at run-time, if this attribute is filled-in. If false, when the attribute is not filled-in, the default empty values (spaces, 0, … ) are accepted.

=============================================
 

as I read it, mandatory FK's should go boom and thus checked in database.
the other stuff will enter null...

Solution
In my opinion this is a strange default behaviour, I would expect not to be able to insert empty values when mandatory is specified.
It's strange, I already had situations where I add a mandatory field and when try to update with a process executed outside of crud screen, gives database constrain error. Unless the behavior change on recent versions
Nelson Inácio wrote:
It's strange, I already had situations where I add a mandatory field and when try to update with a process executed outside of crud screen, gives database constrain error. Unless the behavior change on recent versions
 Think this is only on foreign keys and not on "normal" attributes.
 
Arco van der Velden wrote:
Nelson Inácio wrote:
It's strange, I already had situations where I add a mandatory field and when try to update with a process executed outside of crud screen, gives database constrain error. Unless the behavior change on recent versions
 Think this is only on foreign keys and not on "normal" attributes.
 
The problem is numeric default value is 0, string default value is "", both are different from null. So the database accept these values. Only crud screen will block the update.
 
 
Nelson Inácio wrote:
Arco van der Velden wrote:
Nelson Inácio wrote:
It's strange, I already had situations where I add a mandatory field and when try to update with a process executed outside of crud screen, gives database constrain error. Unless the behavior change on recent versions
 Think this is only on foreign keys and not on "normal" attributes.
 
The problem is numeric default value is 0, string default value is "", both are different from null. So the database accept these values. Only crud screen will block the update.

The CRUD screen only blocks the update if you defined the attribute in screen mandatory as well and if you check for a valid form in your screen action, if not the record will be added wihout any warning or error.