Hi all,
I am trying to update feature attributes from a .NET application that I'm working on.
I've cleaned the code down to the following example:
string serviceUrl = string.Format("http://***.cloudapp.net/arcgis/rest/services/{0}/{1}/FeatureServer", "***", "Test"); string featureUrl = string.Format("{0}/{1}", serviceUrl, "0"); var table = await ServiceFeatureTable.OpenAsync(new Uri(featureUrl)); if (table.IsInitialized) { var found = await table.QueryAsync(1); if (found != null) { found.Attributes["testtext"] = "test"; await table.UpdateAsync(found); if (table.HasEdits) { var result = await table.ApplyEditsAsync(); } } }
It finds the feature with OBJECTID = 1, table.HasEdits is true after the update, and the result variable contains a ResultItem in the UpdateResults property, with no errors and Success = true.
So no errors and no indication something went wrong, but the attribute table in ArcGIS doesn't change at all. If I try to change the geometry of the feature, by adding a line like this:
found.Geometry = new Polygon(new List<MapPoint> { new MapPoint(0, 0), new MapPoint(-5, 0), new MapPoint(-5, -5), new MapPoint(0, -5), new MapPoint(0, 0) });
It will update the geometry correctly... but still no update to the other attributes of the feature.
The feature class in question here, has a field called "testtext" which is of type "Text". I've also tried fields with type short, double, date etc, but I'm still not able to update or add any attribute data.
Any clues as to what I'm doing wrong here? I appreciate any help and tips...
/Tormod
Solved! Go to Solution.
I found the answer while using Wireshark to look at the web request being sent to ArcGIS server. It never sent any attribute updates, until I put the fields I tried to update into table.OutFields..
I found the answer while using Wireshark to look at the web request being sent to ArcGIS server. It never sent any attribute updates, until I put the fields I tried to update into table.OutFields..
if (table.IsInitialized)
{
// Add this code .
table.OutFields = Esri.ArcGISRuntime.Tasks.Query.OutFields.All;
//...
}