Jeff, On Wed, Feb 22, 2017 at 10:03 AM, Jeffrey Kain via 4D_Tech < [email protected]> 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 following: > > If ((JSON Stringify($fieldPtr->))#(JSON Stringify(Old($fieldPtr->)))) > > Seems really inefficient, but it works. > It is inefficient. But JSON is specifically un-ordered and fluid. Personally in situations where I store data in c-objects like this I just re-write the c-object - it's usually no more time than testing to see if I need to re-write it. Another trick I use is to maintain a separate field with the timestamp of when the JSON was written. When it's actually requested look at the timestamp for the last time the record was modified. If they are the same just return the JSON, if they are different re-write the JSON. This is good in cases where the record changes a lot but only gets read occasionally - or never. -- Kirk Brooks San Francisco, CA ======================= ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

