Re: Old doesn't work with object fields

2017-02-23 Thread Arnaud de Montard via 4D_Tech
> Le 23 févr. 2017 à 18:17, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> a > écrit : > > Hi Arnaud, > > You are right, the code does not handle case sensitivity for property names > correctly. [...] now it's perfect to be stolen ;-) Many thanks! -- Arnaud de Montard

Re: Old doesn't work with object fields

2017-02-23 Thread Cannon Smith via 4D_Tech
Hi Arnaud, > On Feb 22, 2017, at 2:25 PM, Arnaud de Montard via 4D_Tech > <4d_tech@lists.4d.com> wrote: > >> : ($atFirstProperty{$x}#$atSecondProperty{$x}) //Check property name > > About the comparison above, json properties are case sensitive. > Things like: >

Re: Old doesn't work with object fields....or rather Objects in General

2017-02-23 Thread Nigel Greenlee via 4D_Tech
David This slightly changes the topic of the OLD on Object fields to a more detailed discussion of the ‘shortcomings' of objects…. (On the topic of the former in my case if I am creating an object in code its likely to be created with the same key order each time so if the ’stringified'

Re: Old doesn't work with object fields

2017-02-22 Thread David Adams via 4D_Tech
On Thu, Feb 23, 2017 at 1:45 PM, Keisuke Miyako via 4D_Tech < 4d_tech@lists.4d.com> wrote: > while I love discussing feature requests, You make a good point about feature requests, but I've got another point of view. Sometimes, it's better for 4D to implement a feature than for us to implement

Re: Old doesn't work with object fields

2017-02-22 Thread Keisuke Miyako via 4D_Tech
while I love discussing feature requests, I also take the pragmatic view that every new feature comes at the cost of an idea delayed if not discarded. so, if anything is already possible with a little bit of creativity, and fulfils the immediate need, I would be ready to accept that, to clear

Re: Old doesn't work with object fields

2017-02-22 Thread David Adams via 4D_Tech
On Thu, Feb 23, 2017 at 12:14 PM, Jeffrey Kain via 4D_Tech < 4d_tech@lists.4d.com> wrote: > Yeah, that's an incredibly good idea. I think it would also be very > useful for tables as well - being able to manage metadata for a table > without creating a special record has been on my wish list for

Re: Old doesn't work with object fields

2017-02-22 Thread Jeffrey Kain via 4D_Tech
Yeah, that's an incredibly good idea. I think it would also be very useful for tables as well - being able to manage metadata for a table without creating a special record has been on my wish list for decades now... > On Feb 22, 2017, at 7:12 PM, David Adams via 4D_Tech <4d_tech@lists.4d.com>

Re: Old doesn't work with object fields

2017-02-22 Thread Kirk Brooks via 4D_Tech
Jeff, On Wed, Feb 22, 2017 at 10:03 AM, Jeffrey Kain via 4D_Tech < 4d_tech@lists.4d.com> wrote: > Doesn't Modified only work in a form event? > ​Yep - my bad. ​ > So it turns out that Old works fine with an object field, but you can't do > an = comparison. I think what I'm going to do is the

Re: Old doesn't work with object fields

2017-02-22 Thread Jeffrey Kain via 4D_Tech
Awesome, thanks Cannon! Jeff -- Jeffrey Kain jeffrey.k...@gmail.com > On Feb 22, 2017, at 1:27 PM, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Hi Jeff, > >> If ((JSON Stringify($fieldPtr->))#(JSON Stringify(Old($fieldPtr-> > > This only works if the order of the keys in

Re: Old doesn't work with object fields

2017-02-22 Thread Cannon Smith via 4D_Tech
Hi Jeff, > If ((JSON Stringify($fieldPtr->))#(JSON Stringify(Old($fieldPtr-> This only works if the order of the keys in the object stays the same which may not be true depending on how you change the object. I’ve pasted in a method below that you can use to compare two objects which

Re: Old doesn't work with object fields

2017-02-22 Thread Lee Hinde via 4D_Tech
4D unpacks it the same each time? > On Feb 22, 2017, at 10:03 AM, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > If ((JSON Stringify($fieldPtr->))#(JSON Stringify(Old($fieldPtr-> > > Seems really inefficient, but it works.

Re: Old doesn't work with object fields

2017-02-22 Thread Jeffrey Kain via 4D_Tech
Doesn't Modified only work in a form event? So it turns out that Old works fine with an object field, but you can't do an = comparison. I think what I'm going to do is the following: If ((JSON Stringify($fieldPtr->))#(JSON Stringify(Old($fieldPtr-> Seems really inefficient, but it works.

Re: Old doesn't work with object fields

2017-02-22 Thread Kirk Brooks via 4D_Tech
Jeff, I think this is going to track back to a discussion some time ago about trying to compare two c-objects, or JSON, to each other. It turns out to be really tricky. For instance: JSON a: {key1:1234, key2:"abcd"} is that equal to {key2:"abcd", key1:1234} or {key2:"abcd", key1:"1234"}

Old doesn't work with object fields

2017-02-22 Thread Jeffrey Kain via 4D_Tech
The subject says it all. It's not documented. Is there a good generic way to see if an object field has changed from within a trigger? -- Jeffrey Kain jeffrey.k...@gmail.com ** 4D Internet Users Group (4D iNUG) FAQ: