Create Synchronization Model Wizard: Download Subset By SQL Expression page

This page allows you to specify the information required to construct a SQL Expression script. This SQL expression is the same as is used in download_cursor scripts. It is partly generated for you. For an example of how to use this option, see the example below.

This page has the following components:

Tables to add to the download cursor's FROM clause   Type the table name(s) if your download_cursor requires a join to other tables. If the join requires multiple tables, separate them with commas. See Writing download_cursor scripts.

SQL expression to use in the download cursor's WHERE clause   Type a SQL expression to be used in the download cursor WHERE clause. You do not have to write a complete download_cursor. You only need to add extra information to identify the join and other restrictions on the download subset. See Writing download_cursor scripts.

Example

Assume you want to subset the download of a table called Customer by MobiLink user and you also want to only download rows where active=1. The MobiLink user names do not exist in the table you are subsetting, so you must create a join to a table called SalesRep, which contains the user names. This example assumes timestamp-based download.

To configure synchronization for this scenario, type the following into Tables To Add To The Download Cursor's FROM Clause:

SalesRep

Type the following into SQL Expression to Use In The Download Cursor's WHERE Clause:

SalesRep.ml_username = {ml s.username} 
   AND Customer.active = 1
   AND Customer.cust_id = SalesRep.cust_id

The following download_cursor script is generated based on these settings:

SELECT "DBA"."Customer"."cust_id",
 "DBA"."Customer"."cust_name"
FROM "DBA"."Customer", SalesRep
WHERE "DBA"."Customer"."last_modified" >= {ml s.last_table_download}
 AND SalesRep.ml_username = {ml s.username}
 AND Customer.active = 1
 AND Customer.cust_id = SalesRep.cust_id

The final line of the WHERE clause creates a key join of Customer to SalesRep.

You can view and modify this script, after the Create Synchronization Wizard finishes, in the Model mode Events tab. See Modifying the download subset.

See also