Add and Updates not working for attributes in ArcGIS Runtime for .Net

1535
0
03-29-2016 06:07 AM
CollinTewalt
New Contributor

Environment:

  • ArcGIS Runtime for .NET 10.2.7
  • ArcGIS Server 10.3.1
  • Map Service with Feature Access enabled (Create, Read, Update)
  • Postgres database underneath the map service

ServiceFeatureTable reportLayer = await ServiceFeatureTable.OpenAsync(new Uri("http://localhost/arcgis/rest/services/MyMapService/FeatureServer/4"));
var testFeature = reportLayer.CreateNew(); //new GeodatabaseFeature(reportLayer.Schema);
testFeature.Attributes["a_commodity_group"] = "fake";
var addedReportOIDs = await reportLayer.AddAsync(testFeature);
var editResult = await reportLayer.ApplyEditsAsync();

It's worth mentioning that the ServiceFeatureTable "reportLayer" here is nonspatial.

I've done the ServiceFeatureTable.CreateNew() as well as creating a new GeodatabaseFeature as described in the documents here:

https://developers.arcgis.com/net/desktop/guide/edit-features.htm#ESRI_SECTION1_2A4C0222216A448C9CBA...

I've tried Adding and Updating features. The "a_commodity_group" attribute is exactly how I see it spelled in the rest endpoint and is a Text/varchar field in the database underneath

I'm seeing none of my attributes come through. (example, the "fake" value that I've put in here)

ArcGIS Server Log (at "Info" level)

FINE Mar 28, 2016, 8:59:46 PM GraphicFeatureServer::HandleRESTRequest

inputJSON = {"rollbackOnFailure":true,"adds":[{"attributes":{"objectid":-10}}]}

Inspecting client traffic from Telerik's Fiddler:

As you can see, the request is totally wrong in that it doesn't have any other attributes going in. enter image description here

BUT,

Manually adding features through "ApplyEdits" in the REST endpoint worked.  enter image description here

Info from ArcGIS Server logs (the attributes come in correctly here):

GraphicFeatureServer::HandleRESTRequest ## inputJSON = {"adds":[{"attributes":{"objectid":-10,"a_commodity_group":"fake"}}],"rollbackOnFailure":true}

I don't see any known issues with this in the ArcGIS Runtime. This is driving me nuts. I can't add features with custom attributes? I think this is a probably a bug, or I'm doing something wrong because the documentation isn't thorough. It'd be nice if the ArcGIS Runtime could support REST operations other than "applyEdits". (Maybe that's for common functionality between ArcGIS Server and ArcGIS Online?) Unfortunately my workaround at this point is going to have to be writing my own thin C# REST client for adding/updating features, but that's why I downloaded the Runtime SDK for .NET in the first place so I could avoid doing that.

0 Kudos
0 Replies