Specifying Outfields on a ServiceFeatureTable

1707
7
07-02-2018 05:04 AM
RobertHaines
New Contributor

In the previous control version (10.2.7) we could use outfields to restrict the data returned for a feature layer e.g.

 

FeatureServiceTable = Await Esri.ArcGISRuntime.Data.ServiceFeatureTable.OpenAsync ...

FeatureServiceTable.OutFields = New OutFields(...)

 

In the current control version (100.2) it appears only the ManualCache feature request mode allows specification of outfields and this can no longer be set on the table itself. We are experiencing frequent crashes using the control and believe it may be memory related hence the desire to limit the outfields (to just the ObjectID). Is there any way to achieve this in the current control? Might this be added back in the next release version?

Thanks,

Robert

0 Kudos
7 Replies
AnttiKajanus1
Occasional Contributor III

Hi
Have you checked that you are calling `LoadAsync` on the features before accessing the attributes?. 

0 Kudos
RobertHaines
New Contributor

Yes in the initial setup.

Me.FeatureServiceTable = ..
Me.FeatureServiceTable.FeatureRequestMode = ..

Await Me.FeatureServiceTable.LoadAsync()

0 Kudos
AnttiKajanus1
Occasional Contributor III

If you are accessing attributes after a query you can use ServiceFeatureTable.QueryRelatedFeaturesAsync Method (ArcGISFeature, RelatedQueryParameters, QueryFe... 

but make sure that you load the Feature as well.

ie.
await mySelectedFeature.LoadAsync();

var myValue = int(mySelectedFeature.Attributes["myKey"].Value)

0 Kudos
RobertHaines
New Contributor

We are looking to restrict what we get back for better performance and to limit memory usage which we think is causing a number of unhandled exceptions.

The old version supported outfields on the table but this appears not to be present on the current version? This means the full attribution is pulled back as we navigate across the map.

0 Kudos
AnttiKajanus1
Occasional Contributor III

I see. As you have seen, at the moment there isn't a way to do that in the API directly. Option on specifying OutFields has been coming up a couple of times lately, I have mentioned this chain in our internal issue that covers this. Currenlty the best way to work around this is actually using Views or content optimized Feature services if you are using server. It might not be a solution on every use case but overall restricting visible fields/attributes for specialized applications is a good way to organize your content. Especially if there are security concerns.

I'm curious on your use case and service setup if you are hitting memory issues with this. How many attributes you have in your features? How many features are you using at the same time? 

0 Kudos
RobertHaines
New Contributor

As requested some background information.

Our desktop application hosts the WPF control within a  Visual Basic Project and this may be deployed as a Citrix install or locally on end-users machines. Therefore these machines may not be high-end or have large amounts of memory. Our test environment has 8 GB of memory.

Our desktop application currently uses version 10.2.5 of the control and this connects to MPK files that our clients generate. With the move to 100.2 we will support both MPK and connection to an ArcGIS Server.

In our test dataset we have in the region of 35 layers covering a large geographic area holding information related to Water Mains, Valves, Boosters, Hydrants, Bursts etc. The attribution across these features varies from 2 to 20 fields at most. An end-user could select all these layers for display which covers millions of features depending on the map scale.

On end-user selection of an item we query the feature table to get back the full attribution for display in an information panel. Hence why we don't need the full attribution being retrieved when an end-user just navigates across the map.

0 Kudos
JenniferNery
Esri Regular Contributor

For ServiceFeatureTable, you can use ManualCache mode to specify the OutFields. If renderer used by service requires for a specific field name and you did not request for it. For example in this case, 'symbolid' then nothing will render.

var table = new ServiceFeatureTable(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/2")) { FeatureRequestMode = FeatureRequestMode.ManualCache };
await table.PopulateFromServiceAsync(new QueryParameters() { WhereClause = "1=1" }, true, new string[] { "objectid", "symbolid" });
MyMapView.Map.OperationalLayers.Add(new FeatureLayer(table));
0 Kudos