Filtering Data for an Offline Publication

See Also

Offline publication filtering is used to limit the data that is taken offline. The Operator and Value lists change based on the type of field you select for your column. For example, if you select a text field, one of the Operator choices is “IsUser.” You can then select “Current User” for your Value. If you select a date column, the Value list contains choices such as “Today,” “1 day ago,” and so on.

For a list of all of the available filtering criteria, see Offline Publication Filtering Reference.

To add or edit filters for a publication

  1. Open your solution in the Access Workflow Designer. For details, see Opening your Solution in the Access Workflow Designer.

  2. In the Object List, expand Offline Publications by clicking the plus (+) sign.

  3. Select an offline publication to display the Offline Publication pane.

  4. In the Offline Publication pane, select the Filter Items tab.

  5. Select the main table for which you want to filter data.

  6. Click Edit Filter.

  7. In the Offline Replication Filter dialog box, select the column on which you want to filter in the Column Name column.

  8. In the Operator column, select a comparison operator.

  9. In the Value column, enter a comparison value.

  10. If you want to specify additional criteria, select a Boolean operator, and add another statement.

  11. Click Add, and then click OK.

Note   If you prefer to enter your own code instead of using the filter grid, you can use the filter edit box.

  1. Select Re-create SQL Publication.

To delete a filter

  1. In the Filter Items tab, select the filter you want to delete, and click Edit Filter.

  2. In the filter edit box, highlight the existing filter, and press Delete.

  3. Click OK.

  4. Select Re-create SQL Publication. When prompted to save, click Yes.

For an example of how to implement offline support, see Offline Support in the Issue Tracking Solution.

Filtering by Current User Example

The following steps provide an example that creates a filter that makes it possible for a user to take only those issues assigned to the user offline.

To create a filter for issues assigned to the user

  1. In the Filter Items tab, select the table for which you want to create a filter, and click Edit Filter.

  2. Select a column that contains user information in the format “domain\user.”

    Note   This matches the format of the SAMAccountName column from modUserList. For details, see Linking Tables to the User Directory.

  3. From the Operator list, select IsUser.

  4. From the Value list, select (current user).

  5. Click Add.

  6. The result looks similar to the following:
    [Issues].[Assignedto] = SUSER_SNAME()


Note   SUSER_SNAME is an SQL function that returns the current user name. If you are familiar with the SQL Query Analyzer, you can use this function to test the recordset that is returned by this filter.

  1. Select Re-create SQL Publication. When prompted to save, click Yes.

When the user creates a subscription to this publication and then takes the solution offline, only those issues assigned to the user are replicated and stored in the local data store.