What is the best way to find item in array
Updated: 21 May 2010 | 2 comments
I have an array that has 150 computers and guids in it. Computers_result[*].guid and Computers_result[*].name. I want to find the guid for the computer named NSbox. I can loop through the array and remove one at a time with a "Get Item from Index", and an equals rule, set it to a variable for the next step, but seems like there should be a component that will loop through an array or a different way to handle finding what the guid is.
Neil Rogers
discussion Filed Under:
Comments
Configurable Collection Filter
The component you're looking for is Configurable Collection Filter. First you specify the data type, input array variable, and whether you want to create a new variable with the result or remove the filtered items from your input variable. Next you have a Filter Model that is run on each item in the array where you can put your logic of whether to keep the item or not. In this model you have a special variable called Element that is the current item in the array that is being tested. In your case you would use a Text Equals Rule and your Compare Variable would be something like Element.name.
how i solved it
This is what i used to solve my problem.
http://juice.altiris.com/tip/5246/collections-and-...
Would you like to reply?
Login or Register to post your comment.