The FilterConditions collection, referenced by the FilterConditions and ExcludeConditions properties of the DataEngine object and a Report object, provides a collection of FilterCondition objects, which describe the filter conditions (exclusion conditions in the case of the ExcludeConditions property) entered by the user for a particular report.

Properties
See Collections for a list of properties.

Methods
See Collections for a list of methods. Pass the name of the field for the filter condition to the AddItem method or set the FieldName property of the returned FilterCondition object. Before adding a filter condition, check whether the condition already exists or not by calling Item with the field name and seeing if the return value is an object or not.


Note: any changes you make to FilterCondition items in C# or VB.Net code is only saved after you call the Dispose() method, as shown in the sample code below.

Here's an example of a DataEngine.FinalizeSQLStatement script that adds a filter condition to a report if it isn't already there:

Visual FoxPro

lparameters toApplication as SQApplication, tcSelect
local loCondition as FilterCondition
loCondition = toApplication.DataEngine.FilterConditions.Item('Customers.Country')
if vartype(loCondition) <> 'O'
  loCondition = toApplication.DataEngine.FilterConditions.AddItem('Customers.Country')
  loCondition.Operator = 'equals'
  loCondition.Values.AddItem('Germany')
endif vartype(loCondition) <> 'O'
return tcSelect

C#

public static string DataEngine_FinalizeSQLStatement(SFQApplication sfqApplication,
  string selectStatement)
{
  FilterCondition condition;
  condition = sfqApplication.DataEngine.FilterConditions.Item("Customers.Country");
  if (condition == null)
  {
    condition = sfqApplication.DataEngine.FilterConditions.AddItem("Customers.Country");
    condition.Operator = "equals";
    condition.Values.AddItem("Germany");
    condition.Dispose;
  }
  return selectStatement;
}

VB.NET

public shared function DataEngine_FinalizeSQLStatement(sfqApplication as _
    SFQApplication, selectStatement as string) as string
  dim condition as FilterCondition
  condition = sfqApplication.DataEngine.FilterConditions.Item("Customers.Country")
  If (condition is Nothing) Then
    condition = sfqApplication.DataEngine.FilterConditions.AddItem("Customers.Country")
    condition.Operator = "equals"
    condition.Values.AddItem("Germany")
    condition.Dispose()
  End If
  Return selectStatement
end function

See Also
Collections | DataEngine Object | FilterCondition Object | Report Object