Creating a filter for replicated data

This task is part of the larger task of creating a DataPropagator subscription. When you have completed these steps, return to Creating a DataPropagator subscription.

Procedure

  1. In the Define Replication Subscription window, select the table for which you want to define column or row filtering.
  2. Click Advanced. The Advanced Subscription Definition notebook opens.
  3. Optional: Define a WHERE clause that selects individual rows to be included in the subscription. You might decide that you want only certain rows to be part of the subscription even if all columns appear in the replica.
    1. Go to the Rows page of the Advanced Subscription Definition window.
    2. In the All rows needed field, type a WHERE clause that defines the selection of rows that you want to appear in the subscription. You can only use the table that you selected in Step 1.

      For example, suppose you want your visiting nurses to see only the rows of data in the PATIENTS table where the value of the JOBCODE column is VNURSE. You could enter the following WHERE clause:

      JOBCODE='VNURSE'
      

      The WHERE keyword must not be used at the beginning of the clause.

      You can click Examples to display sample WHERE clauses.

    3. In the Subset of rows for individual users field, you can type a clause similar to a SQL WHERE clause to further limit the rows that an individual user can see. Ensure you do not type "WHERE" at the beginning of the clause. You might use a parameter, whose value varies by the user. For detailed information about defining a filter at the group level or user level, see Filtering data at the subscription level.

      For example, suppose that you want users to see only data related to their own job codes. Instead of hard-coding a value for the JOBCODE parameter for the entire subscription, define a variable that references the data filter value defined for each individual user:

      JOBCODE=':JOB'
      

      In the data filters for individual users, you could then set the :JOB parameter to each user's job code. See Filtering the data available to the user and Filtering data at the subscription level for more information on filtering data for individual users.

    4. Click OK to close the Advanced Subscription Definition window.
Poznámka:
A series of changes made to a single row in a DB2 Everyplace table on the user's device between synchronizations will be communicated to the Sync Server as a single cumulative change. As a result, a DELETE followed by an INSERT for the same primary key will be communicated to the SyncServer as an UPDATE, if the operations occur with no intervening synchronizations. If they occur with an intervening synchronization, then they are communicated separately. This can lead to an inconsistency when the subscription does not transfer all columns between the source table and the user table, as an UPDATE will retain the current values in the unsubscribed column(s), while the INSERT will set the unsubscribed columns to default values.

Související koncepce

Související úlohy