Re: Difference between OB Copy and :=

2018-06-14 Thread Cannon Smith via 4D_Tech
Thanks Miyako. I was able to test this this morning and found that it does 
indeed work in v17! That’s great.

Thanks.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236




> On Jun 13, 2018, at 9:21 PM, Keisuke Miyako via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> off the top of *my* head I understand the fix is not limited to object 
> notation.
> 
> it was an optimisation made for wakanda server that somehow got lost on its 
> way to 4D object fields.
> 
> so it's a fix at the database level.
> 
>> 2018/06/14 11:54、Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> のメール:
>> 
>> I haven’t had time to try this myself today, but do you know off the top of 
>> your head if this is only fixed when using dot notation? Or is it fixed when 
>> for the old style of code as well (when we had to traverse the object tree 
>> to the children, getting a reference to the child and then changing the 
>> child object without changing the parent object)?
> 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-13 Thread Keisuke Miyako via 4D_Tech
off the top of *my* head I understand the fix is not limited to object notation.

it was an optimisation made for wakanda server that somehow got lost on its way 
to 4D object fields.

so it's a fix at the database level.

> 2018/06/14 11:54、Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> のメール:
>
> I haven’t had time to try this myself today, but do you know off the top of 
> your head if this is only fixed when using dot notation? Or is it fixed when 
> for the old style of code as well (when we had to traverse the object tree to 
> the children, getting a reference to the child and then changing the child 
> object without changing the parent object)?




**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-13 Thread Cannon Smith via 4D_Tech
Hi Tim,

I haven’t had time to try this myself today, but do you know off the top of 
your head if this is only fixed when using dot notation? Or is it fixed when 
for the old style of code as well (when we had to traverse the object tree to 
the children, getting a reference to the child and then changing the child 
object without changing the parent object)?

Thanks.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236




> On Jun 13, 2018, at 12:31 PM, Timothy Penner  wrote:
> 
>> However, be aware of a bug in 4D. If you modify a child object in an object 
>> type field and then save the record, the object will not be saved. It is 
>> only saved if you modify a top level key in the object. The workaround, 
>> until 4D fixes this, is to assign the object field to itself before saving.
> 
> This issue only exists in earlier versions of the product (R releases), where 
> the feature was first introduced.
> 
> In v17.0 this will work as expected, without needing to assign the field to 
> itself.
> 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Difference between OB Copy and :=

2018-06-13 Thread Timothy Penner via 4D_Tech
> However, be aware of a bug in 4D. If you modify a child object in an object 
> type field and then save the record, the object will not be saved. It is only 
> saved if you modify a top level key in the object. The workaround, until 4D 
> fixes this, is to assign the object field to itself before saving.

This issue only exists in earlier versions of the product (R releases), where 
the feature was first introduced.

In v17.0 this will work as expected, without needing to assign the field to 
itself.

-Tim




**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-13 Thread Peter Bozek via 4D_Tech
On Wed, Jun 13, 2018 at 3:26 AM, johnbdhPop via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Thanks Cannon,
>
> So maybe I want to use OB Copy when I load the record in an input
> form. That way I can make changes to the object without changing the object
> in the field. That way if the user cancels I don’t have to worry about the
> field.
>
> When the user saves the record, should I use OB Copy to save the
> object back to the field, or does it really matter?
>
> John
>
>
No and no, imho.

As I understand it, object field contain "serialized" object - it means
object is stored in some internal data structures, you can imagine it is
stored as JSON text (which is not the case, but is OK to visualize how it
works.) When you load the record, object is created (in memory)  from that
representation and reference to it assigned to field. When you save the
record, the object in memory is serialized (converted to JSON) and saved to
disk.

It means, when the record is loaded, you can work with object field as any
object variable (they ay be some exception for the rule, but nothing comes
to my mind now.) There is no need to copy the object field and then copy
object back - what you want to achieve, 4D does transparently.


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-13 Thread 4dialog via 4D_Tech
There is a good article in knowledgebase that describes this:

http://kb.4d.com/assetid=78011   



-
Hilsen
--
Helge Antonsen
www.4dialog.no 
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-12 Thread Cannon Smith via 4D_Tech
The neat thing about objects, in my opinion, is that they are reference based. 
I would try to stay away from using OB Copy unless it is warranted. For 
example, in your example you could just use the field directly or a reference 
to the field. Unless you save the record, changes won’t be put back in the 
database anyway.

However, be aware of a bug in 4D. If you modify a child object in an object 
type field and then save the record, the object will not be saved. It is only 
saved if you modify a top level key in the object. The workaround, until 4D 
fixes this, is to assign the object field to itself before saving.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236




> On Jun 12, 2018, at 7:26 PM, johnbdhPop via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
>   So maybe I want to use OB Copy when I load the record in an input form. 
> That way I can make changes to the object without changing the object in the 
> field. That way if the user cancels I don’t have to worry about the field.
> 
>   When the user saves the record, should I use OB Copy to save the object 
> back to the field, or does it really matter?
> 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-12 Thread johnbdhPop via 4D_Tech
Thanks Cannon,

So maybe I want to use OB Copy when I load the record in an input form. 
That way I can make changes to the object without changing the object in the 
field. That way if the user cancels I don’t have to worry about the field.

When the user saves the record, should I use OB Copy to save the object 
back to the field, or does it really matter?

John




On June 12, 2018 at 3:14:33 PM, Cannon Smith via 4D_Tech (4d_tech@lists.4d.com) 
wrote:

> [Letter Templates]WP_SeriesPictures:=oPictures  

Both [Letter Templates]WP_SeriesPictures and oPictures point to the same 
C_Object instance in memory. If you change either one, they are “both” changed.


> [Letter Templates]WP_SeriesPictures:=OB Copy(oPictures)

[Letter Templates]WP_SeriesPictures and oPictures now point to completely 
separate C_Object instances in memory. If you change one, the other is 
unaffected.

A deep copy means that if the object being copied has child objects (and 
grandchildren, etc.), they are all copied as well. It is then safe to modify 
any level of object knowing you won’t modify the original object.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236




> On Jun 12, 2018, at 7:08 PM, johnbdhPop via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
>  
> What is the difference between the following...
>  
> [Letter Templates]WP_SeriesPictures:=oPictures  
> [Letter Templates]WP_SeriesPictures:=OB Copy(oPictures)
>  
>  
> Both work. The LRM for OB Copy speaks to “a complete (deep) copy of the 
> properties”. What does “deep” mean.

**
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4d_tech-unsubscr...@lists.4d.com
**
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-12 Thread Cannon Smith via 4D_Tech
> [Letter Templates]WP_SeriesPictures:=oPictures  

Both [Letter Templates]WP_SeriesPictures and oPictures point to the same 
C_Object instance in memory. If you change either one, they are “both” changed.


> [Letter Templates]WP_SeriesPictures:=OB Copy(oPictures)

 [Letter Templates]WP_SeriesPictures and oPictures now point to completely 
separate C_Object instances in memory. If you change one, the other is 
unaffected.

A deep copy means that if the object being copied has child objects (and 
grandchildren, etc.), they are all copied as well. It is then safe to modify 
any level of object knowing you won’t modify the original object.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236




> On Jun 12, 2018, at 7:08 PM, johnbdhPop via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> What is the difference between the following...
> 
> [Letter Templates]WP_SeriesPictures:=oPictures  
> [Letter Templates]WP_SeriesPictures:=OB Copy(oPictures)
> 
> 
> Both work. The LRM for OB Copy speaks to “a complete (deep) copy of the 
> properties”. What does “deep” mean.

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Difference between OB Copy and :=

2018-06-12 Thread johnbdhPop via 4D_Tech
 
What is the difference between the following...

[Letter Templates]WP_SeriesPictures:=oPictures  
[Letter Templates]WP_SeriesPictures:=OB Copy(oPictures)


Both work. The LRM for OB Copy speaks to “a complete (deep) copy of the 
properties”. What does “deep” mean.

Thanks,

John


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**