locked
can I do row filtering using SyncOrchestrator? RRS feed

  • Question

  • I have defined a single table in a scope and provisioned it. In the examples using SyncOrchestrator it is very simple but it sync the whole table. I need to sync certain rows only for example (where CustID = 1100). Can do that with SyncOrchestrator?

    When I search for row filters, I found below example. The code looks like written from a completely different approach using SyncAdapters.

    So what is the different between and SyncOrchestrator and SyncAdapter?

    http://msdn.microsoft.com/en-us/library/bb726003%28v=sql.105%29.aspx

    Thursday, September 5, 2013 5:00 AM

Answers

  • Sync Framework doesn't support dynamic filtering, so you cannot arbitrarily select which records you want to sync at sync time.

    not unless you want to intercept the changes in the ChangesSelected event and just let the selected ones go thru.

    • Edited by JuneT Thursday, September 5, 2013 8:57 AM
    • Marked as answer by ZuriJAckshoT Thursday, September 5, 2013 10:47 AM
    Thursday, September 5, 2013 8:56 AM

All replies

  • quick look at the docs installed with the framework would have given you this:

    How to: Filter Data for Database Synchronization (SQL Server)

    • Marked as answer by ZuriJAckshoT Thursday, September 5, 2013 10:47 AM
    • Unmarked as answer by ZuriJAckshoT Thursday, September 5, 2013 10:47 AM
    Thursday, September 5, 2013 6:11 AM
  • Thanks.

    But I can't use this. I've already see that link before.

    In that example ---

                // Create a synchronization scope for retail customers.
                // This action adds rows to synchronization tables but does not create new tables or stored procedures, reducing
                // the permissions needed on the server.
                SqlSyncScopeProvisioning serverProvRetail = new SqlSyncScopeProvisioning(serverConn);
                serverProvRetail.ObjectSchema = "Sync";
                serverProvRetail.PopulateFromTemplate("RetailCustomers", "customertype_template");
                serverProvRetail.Tables["Sales.Customer"].FilterParameters["@customertype"].Value = "Retail";
                serverProvRetail.UserDescription = "Customer data includes only retail customers.";
                serverProvRetail.Apply();
    

    it make the filter as CustomerType = 'Retail' before scope is provisioned.

    My case is, I have a UI, a grid view showing data from [Customers] table.
    From time to time, users can select which customers to be sync-ed to the server (with checkboxes).
    Clients can be multiple. So I want to provision this whole [Customers] table in a scope.
    And at the time of sync, I want to provide a filter like 'WHERE CustID IN (1100,1101,1102 )'

    Thanks.

    Thursday, September 5, 2013 7:16 AM
  • Sync Framework doesn't support dynamic filtering, so you cannot arbitrarily select which records you want to sync at sync time.

    not unless you want to intercept the changes in the ChangesSelected event and just let the selected ones go thru.

    • Edited by JuneT Thursday, September 5, 2013 8:57 AM
    • Marked as answer by ZuriJAckshoT Thursday, September 5, 2013 10:47 AM
    Thursday, September 5, 2013 8:56 AM
  • Thanks for the clarification.

    Then what is the different between this

      http://msdn.microsoft.com/en-us/library/bb726003%28v=sql.110%29.aspx ---- Using SyncAdapter and SyncAgent

    and this

      http://msdn.microsoft.com/en-us/library/ff928701.aspx  ---- Using SyncOrchestrator

    Both is considered using SyncFramework or only the second one is considered using SyncFramework

    If I were to intercept ChangesSelected event, if there any catch? or disadvantage?

    Please help me, really appreciate your previous inputs as well.

    Thursday, September 5, 2013 10:47 AM