IDataStoreBase.FilteredCount Property
.NET Standard 2.x
Gets the number of rows that have been filtered by the current filter criteria.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public int FilteredCount { get; }
System.Int32
The number of rows that have been filtered by the current filter criteria.
Remarks
A DataWindow object
can have filter criteria as part of its definition. After the DataStore retrieves data, the filter is applied and rows that do not meet the filter criteria are moved to the filter buffer. You can change the filter criteria by calling the SetFilter
method, and you can apply the new criteria with the Filter
method.
Examples
The following code example filters the data by criteria (Budget is larger than 200000) and then uses the DataStore FilteredCount
property to get the number of the filtered rows.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreBaseExamples
{
public class FilteredCountExample
{
private readonly SchoolContext _context;
public FilteredCountExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example()
{
// Instantiates datastore with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
Console.WriteLine("Before filtered, Rowcount: {0}",
datastore.RowCount);
// Defines the filter criteria.
datastore.SetFilter("Budget > 200000");
// Filters data that do not meet criteria.
datastore.Filter();
Console.WriteLine("After filtered, Primary Buffer Rowcount: {0}",
datastore.RowCount);
// Gets the number of filtered rows.
int filtercnt = datastore.FilteredCount;
Console.WriteLine("After filtered, Filter Buffer Filteredcount: {0}",
filtercnt);
/*This code produces the following output:
Before filtered, Rowcount: 4
After filtered, Primary Buffer Rowcount: 2
After filtered, Filter Buffer Filteredcount: 2
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x