Result Set Filters

A result set filter is a custom Java class an experienced developer writes in order to specifically manipulate the rows or columns of data returned from a read operation for an MBO.

When a read operation returns data that does not completely suit the business requirements for your MBO, you can write and add a filter to the MBO to customize the data into the form you need.

You can chain multiple filters together. Multiple filters are processed in the order they are added, each applying an incremental change to the data. Consequently, Sybase recommends that you always preview the results, taking note that the MBO has a different set of attributes than it would have had directly from the read operation. You can map and use the altered attributes in the same way you would do so for a regular attribute from an unfiltered read operation.

Example: a simple SELECT statement filter

Suppose you have an MBO based on this query that returns customer information, and you do not want first name and last name divided between two columns (fname and lname) :

SELECT * FROM sampledb.customer

Instead, write a filter that replaces these columns with a single concatenated "commonName" column.

Note: You could also implement the above example with a more advanced SQL statement with additional computation in the MBO definition:

SELECT id, commonName=fname+' '+lname, address, city, state, zip, phone, company_name FROM customer

Example: two separate data sources filter

Suppose you have customer data in two data sources: basic customer information is in an SAP® repository, and more complete details are contained in another database on your network, for example, SQL Anywhere®. You can use a result set filter to combine the SAP customer data with detailed customer data from the database, so that the MBO displays a complete set of information in a single view. You can accomplish this by:
  1. Creating a filter for the SAP backend and add it to an SAP MBO.
  2. Add a JDBC connection for the SQL Anywhere backend in the filter, then use the SQL Anywhere data to filter the SAP result.
  3. Validate the results are what you expect upon completion. When you synchronize the SAP MBO, you should see data from both SAP backend and SQL Anywhere backend.