Venice
DdMan::SetFilter
 
Sets a filter on the file.
 
VARIANT_BOOL SetFilter (
    BSTR bsExpression,
    VARIANT_BOOL bWait
)
 
Parameters
bsExpression
[in] The expression, which is compatible with filters in the Venice modules but limited to the file itself and the system file, you want to use as a filter.
bWait
[in] If this parameter is False, a call to this method returns after the first record is found.
The remaining records are searched in the background and this continues while other code is executed.
Until this process has finished searching for records, it is not recommended to use objects of another dossier or financial year.
If it is necessary to use objects of another dossier or financial year while applying a filter, set this parameter to True and this method will wait until the background process has completed. At that moment, it is safe to use other objects.
 
Return value
True if a at least one record is found after applying the filter, otherwise False.
 
Remarks
Using the SetFilter method to get a list of records is (almost) always slower than using a specific SeekBy/GetNext loop. This is particularly true and can make a significant difference if you can limit the records instead of filtering them.
The sort order of the filtered file is determined by the preceding SeekBy-method.
Filtering a file always starts with the first record according to the sort order and is not influenced by the current position in the file. Unless prematurely canceled, using SetFilter will fetch every record according to that key.
After applying a filter, at least one record is sought and the file is positioned on the first record that matches the filter. For a large file this can take a while. Navigating through the filtered file is done with GetNext and GetPrevious.
Although a SeekBy-method modifies the current position and sort order in a standard file and also has an effect on subsequent calls to GetNext and GetPrevious, this is not the case for a filtered file. A filter has no effect on the result of a SeekBy-method, and a SeekBy-method does not modify the sort order or position in a filtered file.
To cancel a filter, call this method with an empty expression.
To keep the interface as simple as possible, there is neither a GetFirst- nor a GetLast-method, since they can easily be simulated with 'while (GetPrevious ())' and 'while (GetNext ())'.
 
See Also
CreateDdMan
SeekBySysNum
GetNext
 
Samples
 
C++
 
// Establish a sort order
pDdMan->SeekBySysNum (smFirst, 0);

// Apply a filter, limiting to all mandates who have a postal code of 8000
if (pDdMan->SetFilter ("@DDM.PostalCode == \"8000\"", VARIANT_FALSE))
{    
    // Navigate through the filtered file
    do
    {
        // Process record data
    }
    while (pDdMan->GetNext ());
}

// Cancel the filter
pDdMan->SetFilter ("", VARIANT_FALSE);

C#
 
// Establish a sort order
oDdMan.SeekBySysNum (eSeekMode.smFirst, 0);

// Apply a filter, limiting to all mandates who have a postal code of 8000
if (oDdMan.SetFilter ("@DDM.PostalCode == \"8000\"", false))
{    
    // Navigate through the filtered file
    do
    {
        // Process record data
    }
    while (oDdMan.GetNext ());
}

// Cancel the filter
oDdMan.SetFilter ("", false);

VBS
 
' Establish a sort order
Call oDdMan.SeekBySysNum(smFirst, 0)

' Apply a filter, limiting to all mandates who have a postal code of 8000
If oDdMan.SetFilter("@DDM.PostalCode == ""8000""", False) = True Then
    ' Navigate through the filtered file
    Do
        ' Process record data
    Loop While oDdMan.GetNext() = True
End If

' Cancel the filter
Call oDdMan.SetFilter("", False)

VB.NET
 
' Establish a sort order
oDdMan.SeekBySysNum(eSeekMode.smFirst, 0)

' Apply a filter, limiting to all mandates who have a postal code of 8000
If oDdMan.SetFilter("@DDM.PostalCode == ""8000""", False) = True Then
    ' Navigate through the filtered file
    Do
        ' Process record data
    Loop While oDdMan.GetNext() = True
End If

' Cancel the filter
oDdMan.SetFilter("", False)