Hello,
I see from Martin's response that this is possible, though I'm not certain if David had any success. Has anyone had success filtering the contents of a download (i.e., the result of clicking on the "Get Data" button on the Manage Edits form)? I've seen threads in the forum discuss "from scratch" customized downloads, but I'm trying to customize the existing process rather than build from scratch.
Basically, I want to filter the data brought down with "Get Data". I only want inventory items (signs, etc.) from a given layer/feature class from a specific project (e.g., an inspection project) to be brought down to the device (i.e., I don't want the entire inventory brought down - just those for a single project). This seems like it would be a fairly typical requirement, but I don't see any way to configure this in Mobile Project Center of the .amp file.
Here's what I'm doing:
I'm using ArcGIS Mobile 10, build 2525, delivering on a Windows 7 tablet (Trimble Yuma). I've built an extension for the SynchronizeTask. In the OnOwnerInitialized() event, I've added a handler for the PropertyChanged event. In the PropertyChanged event, I'm trapping when the e.PropertyName = "IsGettingData" and e.PropertyName = "IsSynchronizing" (I've been able successfully do stuff when trapping e.PropertyName = "IsPostingUpdates".)
In IsGettingData (and subsequently I've tried this in IsSynchronizing with the same result), I do the following (sorry, it's in VB.NET):
' first I try getting the FeatureLayerSyncAgent via Feature Layers in the Mobile Cache
Dim mc As New MobileCache("D:\Users\<mobile cache location...>")
mc.Open()
For Each fl As FeatureLayer In mc.FeatureLayers
[INDENT]If fl.Name = "<my layer name...>" Then ' Get the layer in question
[INDENT]Dim flsa As New FeatureLayerSyncAgent(fl)
flsa.DownloadFilter = New QueryFilter("ProjectID= 5") ' set the where clause to check a field value[/INDENT]End If
[/INDENT]Next
' alternatively, I try getting the FeatureLayerSyncAgent via Sync Agents in the MobileCacheSyncAgent
Dim msc As New MobileServiceConnection
Dim msa As New MobileCacheSyncAgent(mc, msc)
For Each sa As SyncAgent In msa.SyncAgents
[INDENT]Dim flsa As FeatureLayerSyncAgent = CType(sa, FeatureLayerSyncAgent)
[INDENT]If flsa.FeatureLayer.Name = "<my layer name...>" Then ' Get the layer in question
flsa.DownloadFilter = New QueryFilter("ProjectID= 5") ' set the where clause to check a field value[/INDENT]End If[/INDENT]Next
I verified with debugging that all of these statements execute (i.e., the QueryFilter is set on the FeatureLayerSyncAgent), but "Get Data" still brings down the entire layer. No filtering is done based on the where clause. I also tried limiting the FIDs on the QueryFilter with no success.
Am I missing something? Suggestions?
Thanks,
John