Feature attributes won't update

4409
2
Jump to solution
02-03-2015 12:11 AM
TormodBoga
New Contributor II

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

0 Kudos
1 Solution

Accepted Solutions
TormodBoga
New Contributor II

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..

View solution in original post

2 Replies
TormodBoga
New Contributor II

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..

RezaNourjou
New Contributor II

if (table.IsInitialized)

{

        // Add this code .

         table.OutFields = Esri.ArcGISRuntime.Tasks.Query.OutFields.All;

         //...

}

0 Kudos