Are you sure that FindAll is returning a non-empty array? I'd put a breakpoint in there somewhere and inspect PatternsNumber after the FindAll call and make sure that there are contents in there. Also, what language are you writing in? Is this JScript, C++Script or C#Script? If so, note the following remarks from the documentation.
Result Value
An array of the objects that have the specified values of the specified properties. The returned collection includes the testObj object if it matches the search conditions.
Note for JScript, C#Script and C++Script users: The array returned by the FindAll
method is in the safe array format, which is not compatible with standard JScript arrays. To use such an array in JScript, C#Script or C++Script code, you need to convert it to the native format using the toArray
method of the variant array (see the examples below).