On Thu, Oct 3, 2019 at 10:26 PM Chip Scheide via 4D_Tech <
[email protected]> wrote:
> is it possible to use append array with an object array?
>
>
Sure, I started to use it in v15 and code seems to be working in v17
without problem
> I was playing, and I do not see a way to get this to work.
>
Are you inserting a copy of object into the array? If you do
ARRAY OBJECT($ao;2)
C_OBJECT($o)
OB SET($o;"property";$value)
$ao{1}:=$o
OB SET($o;"property";$newValue)
$ao{2}:=$o
you will end with one object referenced by 3 variables - $o, $ao{1} and
$ao{2}. If you tlater touch $o, both array elements will change (because
all point to the same object data.)
You need something like
ARRAY OBJECT($ao;2)
C_OBJECT($o)
OB SET($o;"property";$value)
$ao{1}:=OB COPY($o)
OB SET($o;"property";$newValue)
$ao{2}:=OB COPY($o)
--
Peter Bozek
**********************************************************************
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]
**********************************************************************