Utility components FindByInfo
This method supports special cases only - when the Info property contains string values! 

Searches for items with a Info property equal to the parameter passed. Search is "in depth". If the VarDictionary object contains other VarDictionary objects in its items they will be searched too. See the details below.

Syntax:

Set result = object.FindByInfo( name, [first [, maxElements [, depth ]]])

IDL definition:

[id(18), helpstring("method FindByInfo")] 
HRESULT FindByInfo(	[in] BSTR bstrName,
			[in,defaultvalue(1)] long lFirst,
			[in,defaultvalue(1)] long lMax,
			[in,defaultvalue(-1)] long lDepth,
			[out,retval] IDispatch** ppResult);

Parameters:

object - Previously created VarDictionary object

name - String - the Infor string to search

first - (optional, number) specifies first element found to be returned (1- based). For example if there are 10 elements with this name and first is set to 5 - then the first 4 elements will not be returned. The default value is 1.

maxElement - (optional, number, default is 1) Maximum elements to return. Search will end when the maxElements are found.

depth - (optional, number, default is -1) If the VarDictionary is a collection of collections - i.e. some items in the collection are other VarDictionary objects you could think about the VarDictictionary object being searched as for a root node in a tree.

 depth specifies how deep the search will be. Value of -1 means unlimited, 0 means - only the current collection, positive number specifies the maximum levels to be searched.

Returns (result): A collection of the items found. Even if the found item is only one it will be placed in a collection containing one item (e.g. it will be its first element). The returned collection is new VarDictionary object. Thus you could determine the actual number of the found items by using the Count property and the found items can be enumerated using For Each ... constructions or indexing the items from 1 to result.Count. The retuned collection enumerates the items (not their names).

Examples:

' Fill some data to prepare the example
Set coll = CreateObject("newobjects.utilctls.VarDictionary")
coll.Add "A", 15
coll.Add "B", 32
coll.Add "C", coll.CreateNew
coll("C").Add "A", 12
coll("C").Add "B", "Blah"
coll("C").Info = "Sample string"
Set found = coll.FindByInfo("Sample string",1,100)
For k = 1 To found.Count
  Response.Write "Found A = " & found(k) & "<BR>"
Next

Remarks:

This method is similar to the other Find methods. Refer to their documentation for more detailed description. The only difference between FindByName and this one is that FindByInfo uses the info property instead of the key of the object in the parent collection.

See also FindByValue method. 

Applies to: VarDictionary

newObjects Copyright 2001-2005 newObjects [ ]