none
Sync Framework - Filter tables based on another related table RRS feed

  • Question

  • Hi,

    I'm trying to use MS Sync Framework to sync a local SQLEXPRESS db with a remoter SQLSERVER db.
    However, I do not want the whole server db to be synced with the client db. Only those rows corresponding to the user of the local db. The problem is that only one of my table has the user id. All other tables refer more or less directly to that table. So in a query, it is easy to select only rows I care about using joins with that table. But in the filter clause how can I do so?

    Tks.

    François

    Tuesday, August 6, 2013 9:54 AM

Answers

  • you can build the filter clause any way you want. internally, the filter clause is just added (AND) with the other internal Sync Fx filter.

    for example, you can do a filter like this for a child table: side.parentId IN (select parentID from ParentTable where userId=@UserID)

    you must note however, that Sync Fx doesnt support dynamic filtering or rows going in and out of scope. e.g., if you remove a user, the child tables will not be notified about it, so they can't remove the rows belonging to that user.
    • Edited by JuneTModerator Tuesday, August 6, 2013 12:23 PM
    • Marked as answer by francois.m Tuesday, August 6, 2013 1:55 PM
    Tuesday, August 6, 2013 12:21 PM
    Moderator

All replies

  • you can build the filter clause any way you want. internally, the filter clause is just added (AND) with the other internal Sync Fx filter.

    for example, you can do a filter like this for a child table: side.parentId IN (select parentID from ParentTable where userId=@UserID)

    you must note however, that Sync Fx doesnt support dynamic filtering or rows going in and out of scope. e.g., if you remove a user, the child tables will not be notified about it, so they can't remove the rows belonging to that user.
    • Edited by JuneTModerator Tuesday, August 6, 2013 12:23 PM
    • Marked as answer by francois.m Tuesday, August 6, 2013 1:55 PM
    Tuesday, August 6, 2013 12:21 PM
    Moderator
  • Tks, I'll give it a try.

    Different question (but related), what is the use of AddFilterColumn exactly? In your example above, would the filter column be parentId or userId?

    Tuesday, August 6, 2013 1:58 PM
  • "side" refers to the current table being synched, so it's parentId
    Wednesday, August 7, 2013 8:20 AM
    Moderator