Right, so this is what Justin has been talking about for some time...I'm always late to the party, it seems. I've got some quotes from Rob and Justin in an old thread about exactly the same question. (Exactly.)
As should be clear to all, I stopped putting time into learning about 4D around V13. I felt like I'd hit a point of diminishing returns and didn't see the point. If I put 20-40 hours into learning something unrelated, I learned a lot. If I put 20-40 hours into learning more about 4D...not as much. Kind of makes sense since I knew a lot about 4D and not as much about anything else. I totally fell in love with D3 and have no regrets ;-) V14-V15 didn't really add enough for me to sell to customers. Sure, they made *my* life better, but for them? Not so clear. V16 changes that. For the first time in ages, it's possible to fundamentally revisit how to solve all sorts of typical problems in native 4D. And, for what it's worth, you can look up commands - programming concepts and design are vastly more important. (And where virtually all of my thinking goes. Grinding out code is just that...which is one reason I like to write code to get machines to grind out code for me.) Anyway, that's why I'm playing catch-up on this stuff. More questions to come. Below is the relevant bits...it's a tidy answer, where it applies. (It applies in my case.) > Finding objects in arrays of objects > On 16 mrt. 2015, at 21:25, Joshua Hunter <[email protected]> wrote: > > What I'm doing now is iterating over the array, getting the value of the id property for each, checking if it matches and then breaking out of the iteration if it does. You can easily solve this by using an object as the root, instead an array object. The root object holds the id as the key and the settings object as the value. For example: C_OBJECT($settings;$server) ` Add server A with id 12345 CLEAR VARIABLE($server) OB SET($server;"id";"12345";"name";"Server A";"address";"192.168.178.1") OB SET($settings;"12345";$server) ` Add server B with id 67890 CLEAR VARIABLE($server) OB SET($server;"id";"67890";"name";"Server B";"address";"192.168.178.10") OB SET($settings;"67890";$server) ` Get server with id 12345 $server:=OB Get($settings;"12345") Justin Leavens [email protected] via lists.4d.com 3/18/15 to 4D What Rob said - use one object instead of an array, with your indexed ID as the top level key, and the objects attached to that. Super-fast lookup. ********************************************************************** 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] **********************************************************************

