>
> On Sat, Jan 7, 2017 at 2:24 PM, Tim Nevels <[email protected]> wrote:

> I’ve done a little work in this area. From my perspective you have 2
choices:
>
> 1. Write code that will take an ARRAY OBJECT parameter and walk the array
> scanning each object element for the value you want. I think of this like
> doing a sequential search on records. You’d have to do some profiling to
see
> if there were any performance issues with big arrays and/or big objects.
>
> 2. Build your own index for the object array. An ARRAY TEXT with values
and an
> ARRAY LONGINT storing the element number. I think of this like an indexed
> search.

Thanks Tim. I can't think of anything else either. I was hoping that I'd
somehow missed a command like Find in object array by attribute." Even if
it were just a convenience command, it would be nice to have in the
language. Perhaps there will be some new features here over time. I've
noticed that the object field query options have continued to evolve.
(Although objects in a field are likely a very different creature than
objects in variables/arrays as record data falls within the scope of the
database engine.)

Bonus: Hey! 4D now has a find in array for sorted arrays. Nice.

http://doc.4d.com/4Dv15/4D/15.3/Find-in-sorted-array.301-3152640.en.html

I've always been too lazy to implement a binary sort so thanks to 4D for
putting one in. Thanks to whoever came up with the feature request, nice
one. For those that don't already know, a 'binary search' on a sorted
structure is a simple, well-known optimization. 4D links to the Wikipedia
entry on the subject:

https://en.wikipedia.org/wiki/Binary_search_algorithm

The description is fine, if a bit formal for a 4D crowd. I'm pretty sure
that there's a 4D tech note from sometime in the mid-1980's about this. I
checked the KB and they don't seem to have notes from that far back.
**********************************************************************
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]
**********************************************************************

Reply via email to