I am trying to figure out how to use the GetFeatureDataAsync overload that allows you to specify a whereClause. Due to bandwidth limitations (wireless aircards), it is NOT feasible to use GetFeatureDataAsync with refreshData = true and re-download the entire layer.
I have figured out the syntax of GetFeatureDataAsync with whereClause, HOWEVER the resulting features are still not updating in my cache. I have verified that I am getting (the correct) data back from my GetFeatureDataAsync, but how to update the cache?
The syntax itself is pretty straight-forward: pass null for fidList if you don't wish to use, and then format the where clause appropriately for your data source (ArcSDE with SQL Server etc.) See code snippet below:
string whereClause = "OWNER_NAME = 'Doe, John H.'";
//string whereClause = "ACRES > 1999";
// --- Synch only certain parcels, based on a whereClause
FeatureLayer parcelLayer = (FeatureLayer)getLayer(mobileService1, parcelLayerName);
mobileService1.GetFeatureDataAsync(parcelLayer, mobileService1.GetExtent(), whereClause, null, "GET PARCELS");
I have verified that I am recieving the desired features back, HOWEVER my cache is not updated unless I first delete the existing features in question, or delete the entire featurelayer from my cache. The latter defeats the whole purpose of getting just the changes/updates to begin with. And I cannot figure out how to do the former because I do not know beforehand what features will be returned by the GetFeatureDataAsync until I execute it, and even afterwards I cannot figure out how to parse through the results of the GetFeatureDataAsync and apply the changes.
There is no help or code samples for these methods so it is quite frustrating. I am also quite mystified why ESRI has made it SO DIFFICULT to synchronize server data changes down to the client, without deleting your entire layer and re-downloading the whole thing. There are lots of posts on this topic in the old forum, so it's clearly something a lot of people need to do.
Anyway, suggestions, code samples, alternate approaches are appreciated.