Filters

To select records in a table, you must use Filters. For information about selecting records, and for examples of Filters being used, see Retrieve a Record. This section describes how to create Filters.

Equality Filters

Filters in ConnectorLib Java are specified in the form of a DatastoreRecord. A datastore record is only returned by the recordSelect method when it matches all columns set in the filter.

For example, if you have a datastore table called table, the following expression creates a Filter that matches all records with "MyValue" in column A:

DatastoreRecord filter = new DatastoreRecord();
filter.setString("A", "MyValue");
A B
MyValue XYZ
MyValue MyValue
XYZ XYZ
XYZ MyValue

Filters can be applied to multiple columns in a table. For example, the following expression creates a Filter that matches all records with "MyValue" in column A and "XYZ" in column B

DatastoreRecord filter = new DatastoreRecord();
filter.setString("A", "MyValue");
filter.setString("B", "XYZ");
A B
MyValue XYZ
MyValue MyValue
XYZ XYZ
XYZ MyValue

Match All Records

To match all records in a table you can use an empty DatastoreRecord as a filter:

     DatastoreRecord emptyFilter = new DatastoreRecord();