locked
Refresh sync statistics RRS feed

  • Question

  • Hello,

    for some reasonons (because of an ID vs UID problem) I have to delete some rows in my table after every sync.
    When I am doing the next sync, the sync statistics show these rows as deleted.
    But I do not want these deleted rows in my sync-statistic.

    Is ther a way to refresh the sync statistics after my "special cleanup" after every sync?

    Or do I have to delete the INFORMATION_SCHEMA.COLUMNS manually?


    Regards,

    Martin


    PS: I am using a MS SQL Server to a mobile SQL CE Server scenario
    Tuesday, January 26, 2010 5:51 PM

Answers

  • Hi Martin,

    since you already  modified the SQL statements anyway, try this:

    1. On the server add an extra column as a flag to indicate the origin of the data (check out the update_originator_id in the SyncFX docs)
    2. Set a default for the new column, for ex. Columnname=Origin, Values:  0 = Server. When an insert is made on the table outside of SyncFX, the value will always be 0
    3. Now modify your SyncFx Insert statement on the server to insert a value of 1 for the new column Origin. This tells you that the insert came from a sync. (your client upload)
    3. Modify the SyncFx Select statement on the server to include add an extra filter on the Origin column where Origin <> 1 (you dont want to pick up the inserts you made via Sync that were tagged as Origin=1.

    this should exclude all the Inserts that you have just uploaded from being enumerated as Inserts in the server, downloaded to your client, only to be deleted again.

    hth,

    JuneT
    Friday, January 29, 2010 3:09 PM

All replies

  • I would like to clarify your sync scenario.

    1. Do you know which rows needs to be deleted at the end of every sync or you have to wait until each sync is completed?
    2. After you were doing delete, were those DELETION uploaded to the server?  Or server never have those rows?
    3. By the way, what scenario makes you doing local delete?

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, January 26, 2010 6:44 PM
    Answerer
  • If you really do not want those locally deleted rows to be uploaded, then here is one work around.

    During upload stage, local changes are enumerated.  Please have a event handler to listen to the client provider event ChangesSelected. 

    In the event handler, please get access to the local data change from e.Context.DataSet.Tables which e is ChangesSelectedEventArgs, a event handler parameter.

    Once you have the datatables, you can modify it before the upload process.

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, January 29, 2010 2:14 AM
    Answerer
  • I would like to clarify your sync scenario.

    1. Do you know which rows needs to be deleted at the end of every sync or you have to wait until each sync is completed?
    2. After you were doing delete, were those DELETION uploaded to the server?  Or server never have those rows?
    3. By the way, what scenario makes you doing local delete?

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Hi,

    thanks for your answers. To your questions. I will start with question 3.:

    My problem is, that I am syncing 5 tables of a huge project (more than 500 database tables). This project is working with IDs instead of UIDs.
    For syncing I run into troubles when using IDs, because I have several mobile clients which all have their own ID-Counters.

    If I sync them all to the server I would get ID-Conflicts. But on the other hand I cannot change the primary key of these 5 tables from ID to UID,
    because too many other of the 500 tables depending on this ID.

    For that reason, I have modified my update/select/delete-statements of the sync process.

    I have IDs as PrimaryKey but I sync via UID. When I transfer new generated data from the client to the server, I transfer them WITHOUT the ID-column.

    The server adds the new rows and generates a new ID for itself. But.... then the server marks this row as new row and transfers it back to the client.
    For this reason I have double entries on my clients then. They have the same UID but different IDs.

    I know that the larger ID always comes from my server. So after every sync I go through the tables and SELECT COUNT(UID)>1. On every row I am getting I delete the row with the smaller ID.


    Question 2:
    No. I never sync deletions from client to the server. My clients only create new data or change data but never delete data.

    Question 1:
    I think this is already answered. If I really have to wait until the sync process is completed or not.... I do not know it. Maybe you do? :-)


    Your suggested solution on the 2nd solution does not work for me, because I never sync deleted rows.
    What I only want is to remove the synced rows in the SyncStatistics, because during the sync process my WinForm writes what the sync process is just doing and it is a bit irretating if it prints out "Deleted 1000 Rows...".


    Regards,

    Martin
    Friday, January 29, 2010 8:58 AM
  • Hi Martin,

    since you already  modified the SQL statements anyway, try this:

    1. On the server add an extra column as a flag to indicate the origin of the data (check out the update_originator_id in the SyncFX docs)
    2. Set a default for the new column, for ex. Columnname=Origin, Values:  0 = Server. When an insert is made on the table outside of SyncFX, the value will always be 0
    3. Now modify your SyncFx Insert statement on the server to insert a value of 1 for the new column Origin. This tells you that the insert came from a sync. (your client upload)
    3. Modify the SyncFx Select statement on the server to include add an extra filter on the Origin column where Origin <> 1 (you dont want to pick up the inserts you made via Sync that were tagged as Origin=1.

    this should exclude all the Inserts that you have just uploaded from being enumerated as Inserts in the server, downloaded to your client, only to be deleted again.

    hth,

    JuneT
    Friday, January 29, 2010 3:09 PM