KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Two different ways to set table object field to Null
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: March 20, 2019

When working with table values, it is often useful to able to set an object field to Null. The two ways are shown below:

Classic 4D Command: SET FIELD VALUE NULL(aField)

// Example 1:
FIRST RECORD([Table_1])
SET FIELD VALUE NULL([Table_1]obj_field)
SAVE RECORD([Table_1])


ORDA: Entity attribute asignment
// Example 2:
C_OBJECT($ent;$status)
$ent:=ds.Table_1.all().first()
$ent.obj_field:=Null
$status:=$ent.save()


Be sure to not mix these ways as trying to directly assign an object field to Null without entities will result in an data type incompatibility error.

[Table_1]obj_field:=Null // Incorrect