KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Null Value Cannot be Assigned to Destination Variable
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: September 29, 2020

When assigning Null to a variable, you may encounter the error The 'Null' value cannot be assigned to the destination variable.



This error is another form of saying the types are incompatible. Null can only be assigned to select variable types (Object, Object Property Collection, Collection Element, Pointer, Picture). If wanting to set a longint typed variable to Null, consider saving the longint variable as an object attribrute and then setting that to Null.

C_LONGINT($longint)
//$longint:=Null //error

C_OBJECT($object)
$object:=New object
$object.longint:=$longint
$object.longint:=Null //no error