FilteredCount method (DataWindows)
Description
Reports the number of rows that are not displayed in the DataWindow because
of the current filter criteria.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Web |
Server component |
Web ActiveX |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder and
Web DataWindow server
component]
1 |
long <span>dwcontrol</span><span>.</span><span>FilteredCount </span>( ) |
[Web ActiveX]
1 |
number <span>dwcontrol</span><span>.FilteredCount</span>( ) |
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, |
Return Values
Returns the number of rows in dwcontrol that
are not displayed because they do not meet the current filter criteria.
Returns 0 if all rows are displayed and –1 if an error
occurs.
If dwcontrol is null, in PowerBuilder
and JavaScript the method returns null.
Usage
A DataWindow object can have a filter as part of its definition.
After the DataWindow 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
These statements retrieve data in dw_Employee,
display employees with area code 617, and then test to see if any
other data was retrieved. If the filter criteria specifying the
area code was part of the DataWindow definition, it would be applied
automatically after calling Retrieve and you would
not need to call SetFilter and Filter:
1 |
dw_Employee.Retrieve() |
1 |
dw_Employee.SetFilter("AreaCode=617") |
1 |
dw_Employee.SetRedraw(false) |
1 |
dw_Employee.Filter() |
1 |
dw_Employee.SetRedraw(true) |
1 |
1 |
// Did any rows get filtered out |
1 |
IF dw_Employee.<span>FilteredCount</span>() > 0 THEN |
1 |
... // Process rows not in area code 617 |
1 |
END IF |
These statements retrieve data in dw_Employee
and display the number of employees whose names do not begin with
B:
1 |
dw_Employee.Retrieve() |
1 |
1 |
dw_Employee.SetFilter("Left(emp_lname, 1)=~"B~"") |
1 |
dw_Employee.SetRedraw(false) |
1 |
dw_Employee.Filter() |
1 |
dw_Employee.SetRedraw(true) |
1 |
1 |
IF dw_Employee.<span>FilteredCount</span>() > 0 THEN |
1 |
MessageBox("Employee Count", & |
1 |
String(dw_Employee.<span>FilteredCount</span>()) + & |
1 |
"Employee names do not begin with B.") |
1 |
END IF |