You are here: Understanding the Meridian object model > About the Vault object > The Vault object methods > FindDocuments method

FindDocuments method

Searches for documents in the Main area of the current vault.

Syntax

FindDocuments([WildCard As String], [DocumentTypeNames As Variant],
[Criteria As Variant], OrSearch As Boolean) _
As IASDocuments
Parameters
Name Description

WildCard

Optional string that represents a file system wildcard pattern. If omitted, the scope of file names will include all documents (*.*).

DocumentTypeNames

Optional variant array of document type names to which to restrict the search result. If omitted, the scope of document types will include all document types.

Criteria

Optional variant array of property filter criteria.

OrSearch

Optional Boolean that if set to True specifies a Boolean OR search be performed. The default is False.

Return Value

Returns a collection of About the Document object objects matching the specified parameters.

Remarks

The Criteria parameter can be specified as a single criterion array or as an array of criterion arrays. Each criterion array contains a property name, operator, and an optional value similar to the Find command in PowerUser. For example, Custom.ProjectNr, equals, 2134, where equals is the operator.

The search operators that are supported are those in the IC_OPERATOR constants enumeration. The following table lists the supported operators and the abbreviations, symbols, and constants that may be used:

Search operator options
Operator Abbreviation Symbol

Constant

contains, in

C

*

IC_OP_CONTAINS

date equals    

IC_OP_DATE_EQUALS

date not equal    

IC_OP_DATE_NOT_EQUAL

date less    

IC_OP_DATE_LESS

date less or equal    

IC_OP_DATE_LESS_EQUAL

date more    

IC_OP_DATE_MORE

date more or equal    

IC_OP_DATE_MORE_EQUAL

doswildcard

   

IC_OP_DOSWILDCARD

empty

EM

()

IC_OP_EMPTY

equals, equal

E

EQ =

IC_OP_EQUALS

less

L

<

IC_OP_LESS

less equal

LE

<=

IC_OP_LESS_EQUAL

like

LI

%

IC_OP_LIKE

more

M

>

IC_OP_MORE

more equal

ME

>=

IC_OP_MORE_EQUAL

not contains

NC, NOT IN

 

IC_OP_NOT_CONTAINS

not empty

NEM

 

IC_OP_NOT_EMPTY

not equal

NEQ, NE

<>

IC_OP_NOT_EQUAL

not like

NLI, NL

 

IC_OP_NOT_LIKE

not starts with

NSW

 

IC_OP_NOT_STARTWITH

starts with

SW

 

IC_OP_STARTWITH

Notes

Example

The following example demonstrates use of the FindDocuments method to display the results of a search executed with the specified parameters.

Sub SearchCount_Execute(Batch)
    Dim StrMask
    StrMask = "*1*.*"
    
    Dim MultipleDocTypes
    MultipleDocTypes = Array("My_Doc_Type", "Hybrid_Doc_Type")

    Dim MultipleCriteria
    MultipleCriteria = Array(_
        Array("Custom.CI",  IC_OP_MORE, 200),_
        Array("Custom.CI",  IC_OP_LESS, 300),_
        Array("Custom.CS",  IC_OP_CONTAINS, "o"),_
        Array("Custom.CStr",  IC_OP_CONTAINS, "iv"),_
        Array("Custom.LOL",  IC_OP_EQUALS, "a-z"),_
        Array("AMVersionablePropertySet._VERSIONNUMBER",  IC_OP_LESS, 2),_
        Array("Custom.CDT",  IC_OP_LESS, (DateSerial(1983,07,12))),_
        Array("NewPS.CB",  IC_OP_EQUALS, False))
        
    Dim bool
    bool = True
    
    Dim Str
    Str = ""

    Dim Document
    
    For Each Document In Vault.FindDocuments(StrMask, MultipleDocTypes, _
        MultipleCriteria, bool)
        str = str &_                  
            " FileName - > " & Document.FileName & vbCrLf &_
            " Document.DocumentType.DisplayName - > " & _
                Document.DocumentType.DisplayName & vbCrLf &_
            " Custom.CI - > " & Document.CI & vbCrLf &_
            " Custom.CS - > " & Document.CS & vbCrLf &_
            " Custom.CStr - > " & Document.CStr & vbCrLf &_
            " Custom.CDT - > " & Document.CDT & vbCrLf &_
            " NewPS.CB - > " & Document.NewPS_CB & vbCrLf &_
            " NewPS.CM - > " & Document.NewPS_CM & vbCrLf &_
            " Custom.LOL  - > " & Document.Custom_LOL & vbCrLf &_
            " Revision - > " & Document.Revision & vbCrLf & vbCrLf
    Next

    WinMsgBox "Total number of documents found is " &_
        Vault.FindDocuments(StrMask, MultipleDocTypes, MultipleCriteria, bool).Count & _
            vbCrLf & vbCrLf & Str
End Sub

Related concepts

Understanding the Meridian functions