Answered by:
Changing the value of a filter column to a value that doesn’t match the current filter

Question
-
If I change the value of a column that is set as filter column and value doesn’t match the filter anymore. The column won’t disappear after synchronization.
Example:
If you have an orderstatus and the client application is filtered to only see orders with orderstatus=1. The client can change the order and after he saves it the status will be changed to orderstatus=2. You would expect that after he clicked the “sync” button the orders would disappear from his screen.
Is there already some way to delete the records that don't match the filter?
Thanks in advanceFriday, February 18, 2011 1:01 PM
Answers
-
afaik, Sync Fx doesnt automatically handle rows "going out of scope" (where the column value has changed and is now outside the range of the filter value)
so in your case, you will have to handle it manually by clearing the rows that has gone out of scope.
- Marked as answer by mjayaram Thursday, March 10, 2011 7:23 PM
Wednesday, March 9, 2011 1:35 PM -
Hi Kees,
The short answer is yes. From sync's point of view we dont do partition reallignment. So if you change a filter value to move it outside your scope then it wont magically change to a delete in your or other peers stores. The best answer is to add that additional filter to your Linq query.
Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar- Marked as answer by Kees Renting Monday, March 14, 2011 2:40 PM
Thursday, March 10, 2011 7:28 PM -
you will have to handle it manually by clearing the rows that has gone out of scope.
This answer is not practicable: If you delete rows on the client side - whether they are "out of range" of your sync scope filters or not - they will be send as tombstones to the server side with the next sync and thus will be deleted from the server as well.
If you want to silently drop rows on the client side you will have to implement your own OfflineSyncProvider and add such capability there.
- Proposed as answer by M.Bi Thursday, March 17, 2011 8:38 AM
- Marked as answer by Kees Renting Thursday, March 17, 2011 2:41 PM
Thursday, March 17, 2011 8:38 AM -
From sync's point of view we dont do partition reallignment. So if you change a filter value to move it outside your scope then it wont magically change to a delete in your or other peers stores.
It would be nice to see this kind of behavior in SyncFX, please.- Marked as answer by Kees Renting Thursday, March 17, 2011 2:41 PM
Thursday, March 17, 2011 8:41 AM
All replies
-
Can you try call clearCache before apply new filter.Monday, February 21, 2011 2:05 AM
-
It is not the filter that is changed. It’s the column value of a column that is filtered.
I tried to clear the cache but it won’t work. It needs to be between the save of the changed data and the load of the new data.Is there some way to do this?
Monday, February 21, 2011 8:29 AM -
I don't know if you didn't read this thread.
http://social.msdn.microsoft.com/Forums/en-US/synclab/thread/73a3af44-d749-4de6-8184-9ef21dc1000d/#70c004cb-0034-4156-a375-c9ddafb16377
That all I know is create new scopeparam with your new value.
Regrad.
Monday, February 21, 2011 9:07 AM -
Thanks for the quick answer.
The thread you mentioned is about changing a filter. I don't want to change a filter.In my example I explain that the filter is set to orderstatus=1. So that client can only see orders with orderstatus=1. That status is changed by the client (after making some changes). The client will still see only orderstatus=1 and the record where the status is changed. The record where the status is changed needs to be removed during sync from the client.
Now my question is: is there some easy way to accomplish this delete, because the record will stay in the isolated storage.
Maybe this question is asked before, but I couldn’t find it here.
Monday, February 21, 2011 9:49 AM -
Because there hasn’t been an answer, can I conclude that there is no solution?
The client knows the status is changed on his side. I can use “LINQ” to filter the collection a second time. I think this is the best work around. But when I do this the next problem will show up.
When client1 changes the status into a value that doesn’t match the filter of client2. Client2 will still see the row with the old data. In this case “LINQ” can’t help me.
Is there a solution to this problem?
Monday, March 7, 2011 8:29 AM -
afaik, Sync Fx doesnt automatically handle rows "going out of scope" (where the column value has changed and is now outside the range of the filter value)
so in your case, you will have to handle it manually by clearing the rows that has gone out of scope.
- Marked as answer by mjayaram Thursday, March 10, 2011 7:23 PM
Wednesday, March 9, 2011 1:35 PM -
Thanks for the reply
I wanted to know for sure that I wasn't going to make work for nothing.
I can handle it myself if the client itself causes the row to go outside of the scope.But when another client will cause the row to go outside of the scope it will be a bigger problem..
Because the row will keep the old information and I can't figure out how to handle that situation without using a new or second connection to the server.Wednesday, March 9, 2011 2:23 PM -
This is another way to work around, but it not a good solution.
After client change status, you call CacheController.RefreshAsync() to apply change to server, call clearCache and call CacheController.RefreshAsync() again.
Thursday, March 10, 2011 2:32 AM -
Thanks for the reply BruceDo.
This is one of the workarounds i could use, but the best way i think is to filter the collection.
Like this:orders = from o in context.OrderCollection
where o.orderstatus==1
select o;both workarounds will do their job when the client itself changes the value.
clearcache is an option, but will take more time.The only workaround i haven't figured out is how to know if another client has changed the value of a column I'm filtering.
Thursday, March 10, 2011 9:31 AM -
Hi Kees,
The short answer is yes. From sync's point of view we dont do partition reallignment. So if you change a filter value to move it outside your scope then it wont magically change to a delete in your or other peers stores. The best answer is to add that additional filter to your Linq query.
Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar- Marked as answer by Kees Renting Monday, March 14, 2011 2:40 PM
Thursday, March 10, 2011 7:28 PM -
Hi Kees.
Your response is correct. You can use LINQ to filter data at client size. But data unnecessary still remain at client until you Refresh sync.
Friday, March 11, 2011 2:30 AM -
you will have to handle it manually by clearing the rows that has gone out of scope.
This answer is not practicable: If you delete rows on the client side - whether they are "out of range" of your sync scope filters or not - they will be send as tombstones to the server side with the next sync and thus will be deleted from the server as well.
If you want to silently drop rows on the client side you will have to implement your own OfflineSyncProvider and add such capability there.
- Proposed as answer by M.Bi Thursday, March 17, 2011 8:38 AM
- Marked as answer by Kees Renting Thursday, March 17, 2011 2:41 PM
Thursday, March 17, 2011 8:38 AM -
From sync's point of view we dont do partition reallignment. So if you change a filter value to move it outside your scope then it wont magically change to a delete in your or other peers stores.
It would be nice to see this kind of behavior in SyncFX, please.- Marked as answer by Kees Renting Thursday, March 17, 2011 2:41 PM
Thursday, March 17, 2011 8:41 AM -
Or put a interceptor on the server and do a "Skip rows". We had the option of Skip in addition to RejectChange but couldnt squeeze it in due to time crunch. The skip is a viable option for server to protect itself but I agree that more control at the client side would be useful as well.
Maheshwar Jayaraman - http://blogs.msdn.com/mahjayarThursday, March 17, 2011 5:40 PM