FilteredCount

Description

Reports the number of rows that are not displayed in the DataWindow because of the current filter criteria.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object

Web

Server component

Web ActiveX

DataWindow control, DataWindowChild object

Syntax

PowerBuilder and Web DataWindow server component

long dwcontrol.FilteredCount ( ) 

Web ActiveX

number dwcontrol.FilteredCount( )

Argument

Description

dwcontrol

A reference to a DataWindow control, DataStore, or child DataWindow

Returns

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

Example 1

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:

dw_Employee.Retrieve()

dw_Employee.SetFilter("AreaCode=617")

dw_Employee.SetRedraw(false)

dw_Employee.Filter()

dw_Employee.SetRedraw(true)


// Did any rows get filtered out

IF dw_Employee.FilteredCount() > 0 THEN

		... // Process rows not in area code 617

END IF

Example 2

These statements retrieve data in dw_Employee and display the number of employees whose names do not begin with B:

dw_Employee.Retrieve()


dw_Employee.SetFilter("Left(emp_lname, 1)=~"B~"")

dw_Employee.SetRedraw(false)

dw_Employee.Filter()

dw_Employee.SetRedraw(true)


IF dw_Employee.FilteredCount() > 0 THEN

		MessageBox("Employee Count", &

			String(dw_Employee.FilteredCount()) + &

			"Employee names do not begin with B.")

END IF

See also