none
Checking Target Side Data before synchronizing RRS feed

  • Question

  • Hello Everyone, I have been lately working with Microsoft Sync Framework and really enjoying it. However, I came across a scenario, in which I’m really having a problem in knowing if it has a solution or not. What I’m doing is using SyncOrchestrator to sync two live databases. The application is working fine in upload, download and even both ways. However, I have reached a table in which I would only want to synchronize data according to a date column. I would only want to sync data that have a higher date value than those in the target table. So if I have table 1 at the left side, and Table 2 at the target, I would only want data from Table 1 to be downloaded to Table 2, only and only if the date check returned greater than the same row in Table 2, otherwise, I wouldn’t want to download old data. Could this be done? How could it be done? Please inform me if I wasn’t clear and if some more information was required. Thanks a lot Basil
    Tuesday, August 2, 2011 5:11 AM

Answers

  • you can intercept the changes in the ChangesSelected or ApplyingChanges event, loop thru the changes to select the corresponding target row and compare the dates. if the target has a much later date, simply remove the row from the change dataset that you intercepted.
    • Marked as answer by yimkin Wednesday, August 3, 2011 6:07 AM
    Tuesday, August 2, 2011 1:09 PM
    Moderator

All replies

  • are you trying to compare rows after Sync Fx has retrieved the changes and before a change gets applied or are you trying to get Sync Fx to retrieve changes based on date? 

    Tuesday, August 2, 2011 11:52 AM
    Moderator
  • June,

    Thanks for your reply.

    I am trying to know what is the latest date value BEFORE changes are applied.

    If "row 1" from "table 1" on the SOURCE database had a date value of "01-01-2011" for example, and on the TARGET database "row 1" from "table 1" had a date value of "02-02-2011" then it shouldn't be synced because it is simply newer. However, if "row 2" from "table 1" on the SOURCE database had a date value of "02-02-2011", and on the TARGET database "row 2" from "table 1" had the value of "01-01-2011" then I want it to sync and thus have the data change to become the latest version of that row.

    Sync has never been done on the 2 tables I'm talking about, and again I'm using SyncOrchestrator. However, I need to know what should I add, so that the "download" process that will take place from the Source to the Target, would only effect the old rows on the Target Database. Again Old according to the [date] value.

    Thanks

    Basil

     


    Basil
    Tuesday, August 2, 2011 12:15 PM
  • you can intercept the changes in the ChangesSelected or ApplyingChanges event, loop thru the changes to select the corresponding target row and compare the dates. if the target has a much later date, simply remove the row from the change dataset that you intercepted.
    • Marked as answer by yimkin Wednesday, August 3, 2011 6:07 AM
    Tuesday, August 2, 2011 1:09 PM
    Moderator
  • June,

    Thanks a lot. It is working great


    Basil
    Wednesday, August 3, 2011 6:07 AM
  • When looping tjhrough the changes how do "select the corresponding target row"?

    Is a dataset with the corresponding target rows included in the event arguments to ChangesSelected or ApplyingChanges?

    Do you have to execute an sql command to read the corresponding target row?

    Thanks


    Howard P. Weiss

    Wednesday, January 28, 2015 6:29 PM
  • the only time the destination row is loaded is on a conflict. so you will have to query it yourself in all other cases.
    Wednesday, February 18, 2015 2:49 AM
    Moderator