combit List & Label 30 - .NET Help
combit.Reporting.DataProviders Namespace / ITable Interface / ApplyFilter Method
Filter string "<FieldName>=<Value>". If you work with combined primary keys, you will get the key field name separated by tab as well as the values, e.g. "CustomerID\tOrderID=22\t14". If this parameter is empty, the row filter should be reverted and all rows should be selected again. See also ChildColumnName Property and ParentTableName Property.
Example


ApplyFilter Method
This method is called to set a row filter on the rows of the table. The syntax of the passed in string is "<FieldName>=<Value>". The method will only be called if the SupportsFiltering Property returns true. If it doesn't, you don't need to implement this method and may safely throw a NotImplementedException. Be aware that your data provider will not be able to support drill down reporting in this case, however.
Syntax
'Declaration
 
Sub ApplyFilter( _
   ByVal filter As String _
) 
 

Parameters

filter
Filter string "<FieldName>=<Value>". If you work with combined primary keys, you will get the key field name separated by tab as well as the values, e.g. "CustomerID\tOrderID=22\t14". If this parameter is empty, the row filter should be reverted and all rows should be selected again. See also ChildColumnName Property and ParentTableName Property.
Example
public void SetRowFilter(string rowFilter)
{
    DataViewSetting setting = _dataView.DataViewManager.DataViewSettings[_dataView.Table.TableName];
    if (String.IsNullOrEmpty(rowFilter))
    {
        setting.RowFilter = _savedRowFilter;
    }
    else
    {
        _savedRowFilter = setting.RowFilter;

        // convert row filter format to col='val'. Input is col=val.
        string[] parts = rowFilter.Split('=');
        string converted = parts[0] + "='" + parts[1] + "'";

        _dataView.RowFilter = converted;
        setting.RowFilter = converted;
    }
}
Public Sub SetRowFilter(rowFilter As String)
    Dim setting As DataViewSetting = _dataView.DataViewManager.DataViewSettings(_dataView.Table.TableName)
    If [String].IsNullOrEmpty(rowFilter) Then
        setting.RowFilter = _savedRowFilter
    Else
        _savedRowFilter = setting.RowFilter

        ' convert row filter format to col='val'. Input is col=val. 
        Dim parts As String() = rowFilter.Split("="C)
        Dim converted As String = parts(0) + "='" + parts(1) + "'"

        _dataView.RowFilter = converted
        setting.RowFilter = converted
    End If
End Sub
Requirements

Platforms: Windows 10 (Version 21H2 - 23H2), Windows 11 (21H2 - 22H2), Windows Server 2016 - 2022
.NET: .NET Framework 4.8, .NET 6, .NET 8, .NET 9

See Also