Tech Tip: Remove all attributes from child object to guarantee removal of all references
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: March 20, 2019
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
When trying to remove all references to a child object within a parent object, one mistake is to remove the parent attribute and assume child object is also removed. Take the example below:
$parent_o:=New object("child";$child_o) // $parent_o.child is a new reference to $child_o
If the child attribute is removed using OB REMOVE($parent_o;"child") or $parent_o.child:=Null, $child_o will still retain its reference.
In order to successfully remove an object and all of its references, you must remove all of the attributes from the child like shown below:
For each ($attr_t;$parent_o.child)
End for each