Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Evaluating Filters in the Apex Connector Framework

A filter evaluates to true for a row if that row matches the conditions that the filter describes.

For example, suppose that a DataSource.Filter has columnName set to meaningOfLife, columnValue set to 42, and type set to EQUALS. Any row in the remote table whose meaningOfLife column entry equals 42 is returned.

Suppose, instead, that the filter has type set to LESS_THAN, columnValue set to 3, and columnName set to numericCol. We’d construct a DataSource.TableResult object that contains all the rows that have a numericCol value less than 3.

To improve performance, do all the filtering in the external system. You can, for example, translate the Filter object into a SQL or OData query, or map it to parameters on a SOAP query. If the external system returns a large set of data, and you do the filtering in your Apex code, you quickly exceed your governor limits.

If you can’t do all the filtering in the external system, do as much as possible there and return as little data as possible. Then filter the smaller collection of data in your Apex code.