That will work, if you’re not using Cannon’s OBJ methods. Cannon’s methods
allow you to search multiple levels of an object using dot notation in the key
name (a key-path). So if your objects had attributes that were objects, like:
[
{ “name” : { “first”: “Chip”, “last”: “Scheide”}, “address”: {…} },
{ “name” : { “first”: “Jim”, “last”: “Crate”}, “address”: {…} },
]
then you could call the search like:
$firstName:=“Chip"
$foundIdx:=OBJA_Find_in_Array(->$objectArr;”name.first”;->$firstName)
It’s common to have to deal with nested objects if you start working with data
from some external API, like the Square API, so being able to easily search
that way is useful.
Jim Crate
> On Oct 17, 2019, at 5:58 PM, Chip Scheide <[email protected]> wrote:
>
> Jim,
> why does this not work?
>
> C_POINTER($1;$Array;$3;$Value)
> C_TEXT($2;$Property)
>
> $Array:=$1
> $Property:=$2
> $Value:=$3
>
> For ($i;1;Size of array($Array->))
>
> If (OB Is defined($Array->{$i};$Property))
>
> If (OB Get($Array->{$i};$Property)=$Value->)
> $0:=$i
> $i:=Exit_Loop
> End if
> End if
> End for
>
>
> We have done so much, with so little, for so long;
> We are now qualified to anything with nothing <sigh>
> - unknown
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************