none
FilterTemplates Sync Fx v2.1 RRS feed

  • Question

  • Hi,

    Database table Structure
    
    UserProductMapping[Table]		Product[Table]
    UserID(PK, int)			ProductID (int)
    ProductID (int)			ProductName (varchar(100))

    The following code will Sync only the Data related to the logged-in User(@UserID) from central to local server, but the Product table data should Sync only the ProductID of logged-in User(@UserID) from central to local server

    serverConfig.Tables["UserProductMapping"].AddFilterColumn("UserID");
    serverConfig.Tables["UserProductMapping"].FilterClause = "[side].[UserID] = @UserID";
    SqlParameter param = new SqlParameter("@UserID", SqlDbType.Int, 4);
    serverConfig.Tables["UserProductMapping"].FilterParameters.Add(param);

    Would appreciate the answers

    Regards,

    Vishal Mohan

    Friday, September 24, 2010 2:33 PM

Answers

  • Sync Fx doesnt handle joins/foreign keys automatically.

    in your scenario, you will have to set the filter on the Product table itself.

    try putting the filter clause as : "[side].[ProductId] IN (SELECT ProductId FROM UserProductMapping WHERE UserId = @UserID)"

    Monday, September 27, 2010 3:05 PM
    Moderator

All replies

  • any response JuneT.

     

     

    Monday, September 27, 2010 5:43 AM
  • Sync Fx doesnt handle joins/foreign keys automatically.

    in your scenario, you will have to set the filter on the Product table itself.

    try putting the filter clause as : "[side].[ProductId] IN (SELECT ProductId FROM UserProductMapping WHERE UserId = @UserID)"

    Monday, September 27, 2010 3:05 PM
    Moderator
  • Thanks JuneT, i really appreciate the response.
    Thursday, September 30, 2010 5:45 AM