Chip,

Use the For each...End for each loop construct to iterate over the array of 
objects, something like (untested written off the bat):

For ($i;1; size of array(object_array))
  For each(property;object_array{$i})
    If ([property="Object_Name")
      If (object_array{$i}.property="Fred") //or object_array{$i}[property] 
should also work I think if you prefer bracket notation
        //do something here...
      End if
    End if
  End for each
End for

Like I said though, I have not tested the above code!

Regards,
Narinder Chandi,
ToolBox Systems Ltd.
 
I am available for new consulting opportunities…
http://4d.1045681.n5.nabble.com/ANN-4D-Developer-Available-td5765443.html
-- 

-----Original Message-----
From: 4D_Tech <[email protected]> on behalf of 4D Tech Mailing List 
<[email protected]>
Reply-To: 4D Tech Mailing List <[email protected]>
Date: Thursday, 17 October 2019 at 22:06
To: 4D Tech Mailing List <[email protected]>
Cc: Chip Scheide <[email protected]>
Subject: Object Array - finding an object with attritbute value

    Given that I have an array of objects - Array Object(object_array;5)
    
    (hand waving) I populate the array with objects ...
    
    how do I find which object in the array has an attribute/property with 
    a specific value?
    ex: property "Object_Name" : "Fred"
    
    How do I find the array element (object) in which the property 
    'Object_Name = "Fred"?
    
    Chip
    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]
    **********************************************************************


**********************************************************************
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]
**********************************************************************

Reply via email to