Database Engines:odbc

Filtering records Professional

A typical task for database applications is to process only a subset of data stored in a database table. Subsets can be created in different ways, one of which is provided by the SET FILTER command. It defines a logical condition for records to become visible in a work area. Records that do not match the filter condition remain existent but become invisible.

The creation of subsets is greatly enhanced by SQL DBMSs so that SET FILTER can be assumed to be obsolete, although this command can still be used:

cSQL := "SELECT * FROM Customer WHERE State='NY';" 
USE (cSQL) 

SET FILTER TO FIELD->LASTNAME > "M" 
Browse() 

The effect of this code is that the DBMS prepares a subset of records matching the WHERE clause of the SQL SELECT statement (all customers living in New York). This means that the subset is prepared on the server side of the application and only a limited amount of data is transferred to the client. An additional filter condition defined with SET FILTER is then executed on the client side of the application and reduces the visible data of the subset further.

As a result, the creation of subsets of data should be done on the server side, if possible. This reduces the amount of data transferred to the client, which, in turn, leads to less network traffic and speeds up the response time of the client/server application. An additional SET FILTER command can be used in this case to create sub-subsets efficiently since the initial subset is sent only once from the server to the client.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.