I am unable to do $oChildObject:=null in my actual situation because I am 
passing that object into a Dialog so in my situation $oParentObject is actually 
the Form object, I don't have the local variable for $oChildObject on the form. 
 So is there another command to clear both references without having loop over 
all properties in the child and remove them individually?  

Drew

-----Original Message-----
From: Olivier Deschanels <[email protected]> 
Sent: Thursday, February 21, 2019 1:21 PM
To: 4D iNug Technical <[email protected]>
Cc: Drew Waddell <[email protected]>
Subject: Re: Object notation bug?

Hi,

That’s not a bug. That’s normal.

$oChildObject:=New object create a reference to a object store in $oChildObject

 OB SET($oParentObject;"ChildInformation";New object) push another reference 
into the $oParentObject but the old reference still exist because $oChildObject 
isn’t cleared.

you try :  $oParentObject.ChildInformation:=Null
try this  $oChildObject:=null

and read $oParentObject

Regards,

Olivier



Olivier Deschanels
Consultant Expert

4D SAS
66 route de Sartrouville
Parc Les Erables - Batiment 4
78230 Le Pecq
France

Téléphone : +33 1 30 53 92 75
Standard :  +33 1 30 53 92 00
Fax :       +33 1 30 53 92 01
Email :     [email protected]
Web :       www.4D.com






> Le 21 févr. 2019 à 18:59, Drew Waddell via 4D_Tech <[email protected]> a 
> écrit :
>
> I am trying to figure out if this is a bug or not.  This is a watered down 
> version of something I am trying to do:
>
>                C_OBJECT($oParentObject;$oChildObject)
>
>                $oChildObject:=New object
>                $oParentObject:=New object
>                $oParentObject.ChildInformation:=$oChildObject
>                $oParentObject.ChildInformation.FirstName:="John"
>                $oParentObject.ChildInformation.LastName:="Smith"
>
> I want $oChildObject and $oParentObject.ChildInformation to remain the same 
> and should because of how the references work, so at this moment each are 
> {FirstName:John,LastName:Smith}.  Let say something happens like maybe there 
> is a Clear button, how would one clear the child object?
>
> First, I wanted to do this:
>
>                $oParentObject.ChildInformation:=Null // $oChildObject = 
> {FirstName:John,LastName:Smith}
>
> Okay, I thought that was the correct way to clear both objects but maybe 
> there is a different way so maybe this?
>
>                OB SET($oParentObject;"ChildInformation";New object) // 
> $oChildObject = {FirstName:John,LastName:Smith}
>
> Nope, again the child object with $oParentObject is cleared but $oChildObject 
> remains {FirstName:John,LastName:Smith}.  So do I really have to loop over 
> all properties and remove them individually?
>
>                OB REMOVE($oParentObject.ChildInformation;"FirstName")
>                OB REMOVE($oParentObject.ChildInformation;"LastName")  // 
> $oChildObject = {}
>
> Finally when I make a change in the $oParentObject.ChildInformation the 
> referenced object $oChildObject is also updated.
>
> Is this a bug?  Shouldn't the :=Null work and also change the $oChildObject 
> variable?
>
> Thanks,
> Drew
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to