locked
Set different filter on client RRS feed

  • Question

  • Hi,

    In my solution, there is a hierarchy:

    Company->Estate->Block->Area

    Data at the top level (for a particular company) is filtered by CompanyID (e.g. 'global' data such as lookup lists).

    Within a particular company, there might be dozens of estates, hundreds of blocks and thousands of areas.

    I don't want to download all data (as there's too much) and a user is likely to be working one estate at a time (which might have 100s of related child rows).

    So, I have an estate selection screen where the user picks from a list of estate and then my app performs a sync by downloading all blocks and areas for the selected estate. My user then performs their work on the selected estate and then moves to the next one.

    Data for the selected estate is filtered by EstateID and I've set up all of the necessary filters within sync services and is working fine (albeit, I'd like faster performance)

    However, when the user re-selects a new estate I'd like to keep the data that they've already downloaded on the device so that if in the future, they revisit the same estate (quite likely) the next sync won't take as long (as data will have already been downloaded). When a user selects a new estate, I'd like to append data for the different estate to the existing data on the device so that gradually the user builds up a local data store that requires less and less sync time.

    Does anyone know if this is a workable strategy with sync services?
    • Moved by Max Wang_1983 Thursday, April 21, 2011 1:14 AM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Thursday, July 16, 2009 11:03 AM

Answers


  • Hi SunHunter

    Chaning dynamic filter values is not currently supported out of box.  Below are a few suggestions you may consider with dynamic filtering change scenarios:


    1. Re-initialize the db to create a fresh one if users don’t care about data with previous filter
    2. Create a new instance of SqlCe Database with the new filter value. If there are not too much shared data.
    3. Use table mapping to create new client side tableName for different partition of data. – this will address the drawback for option #2 since the database can be shared in the same client DB.


    #2 and #3 are probably what you can use to achieve your scenario. #2 will require some application level logic if you want to join tables between to databases, #3 will require your application to handle table mapping and probably some other extra logic based on how complex your scenarios and your schemas ( like RIs among tables etc ) are. so you will need to evaluate those approaches and decide one to use.

    Hope this helps.

    Thanks
    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, July 29, 2009 10:03 PM
    Moderator

All replies

  • Hi, still running into issues attempting the above. I don't think I phrased it very clearly what I am trying to do... so, I'll try again (as it is still a bit of an issue to me):

    1. A user syncs 'download only' data to a device partitioned/filtered by some value (in my case: an estate)  (N.B. a single estate in my app is one node of a hierarchy each containing several hundred child rows)
    2. The user works with that data until they want to select a different estate.
    3. The user selects a different estate to download
    4. At this point, another sync is requested from the server and the estates data is deleted from the device so that the 'sync anchors' can be cleared (I couldn't find any other way of forcing a re-sync other than dropping the relevant table and then creating it again as part of the sync - because the filter value is different each time, the sync seems to get in a mess if I don't do this).

    Ideally, when a user selects a new estate, I'd like to keep the existing data on the device instead of dropping the table so that if the user ever wants to work with that particular estate again, they don't have to re-sync from scratch. However, if I keep the table on the device (without dropping it), the sync anchors are set to the 'wrong' position as they will be referring to a sync which used a different filter value and not to the sync that was used to originally download that particular set of data.

    Some partitions are bigger than others and have a few thousand rows. A one-off sync to 'initialise' the app is acceptable but to re-sync the same data each time is a show-stopper for my app. if I can get away with an initial sync to get the data onto the device (and then keep it there!), things would be much better...

    I guess another question might be: Is it possible to keep a separate sync anchor per filter value? That way, I could plug a different sync anchor into the sync at runtime depending on the filter value that is being requested? I'm not sure where to start with this and I'm guessing other people must have had similar situations, so any hints appreciated.
    Friday, July 24, 2009 5:28 PM

  • Hi SunHunter

    Chaning dynamic filter values is not currently supported out of box.  Below are a few suggestions you may consider with dynamic filtering change scenarios:


    1. Re-initialize the db to create a fresh one if users don’t care about data with previous filter
    2. Create a new instance of SqlCe Database with the new filter value. If there are not too much shared data.
    3. Use table mapping to create new client side tableName for different partition of data. – this will address the drawback for option #2 since the database can be shared in the same client DB.


    #2 and #3 are probably what you can use to achieve your scenario. #2 will require some application level logic if you want to join tables between to databases, #3 will require your application to handle table mapping and probably some other extra logic based on how complex your scenarios and your schemas ( like RIs among tables etc ) are. so you will need to evaluate those approaches and decide one to use.

    Hope this helps.

    Thanks
    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, July 29, 2009 10:03 PM
    Moderator
  • Hi Yunwen, thanks for the reply, it seems that i'm going a bit further away from the core framework with this (surprising as I thought this would be quite a common usage scenario for a lot of businesses).

    In my solution, I have maybe four or five tables that are filtered by geographical area. The business scenario is that of a QA inspector who on a given day is assigned to work in a geographical location to carry out a series of inspections (they download a checklist of items to inspect for a given location - each checklist might have hundreds of items. On a given day, a worker might visit 50 locations (which might all be in the same building) to tick off a QA checklist. They might not always have a mobile signal due to the nature of the buildings and so the data needs to be cached intelligently and used wisely.

    On a given day, the mobile worker syncs data for the location they are inpsecting, the list of tasks for a given location might consist of anything up to 10,000 records (the list of items to be inspected at each location doesn't change that much and is individual to each location, so next week when the worker visits the same location they might end up downloading the same list of tasks all over again), but they are likely to visit somewhere else in the interim. Downloading and caching 10,000 records over a GPRS connection is not fun - it currently takes approximately four minutes (even with GZip implemented). 

    I was hoping to save my users time, if they have already downloaded that list of 10,000 tasks for a given location, they would only have to download *incremental* changes (and not the entire 10,000 rows all over again) if they subsequently visit the same place again after the data has been re-filtered to another location.

    Anyway, maybe an idea for a new feature if it's not already on the list for v3.0...

    Many thanks again for your suggestions, I'll see if I have any success with trying them out...

    SunHunter
    Wednesday, July 29, 2009 11:25 PM
  • hello, I have simiar issue, but one client will have 1 filter by it's department so in general it wont be changed, can you say is it also dynamic? 
    or there's some solution for that?

    C# developer
    Wednesday, August 5, 2009 8:02 PM