Select to view content in your preferred language

Edits are not saved

1706
5
10-06-2011 03:20 PM
AjaySisodia2
Emerging Contributor
Hello:

I developed an point editing application. I think i have all the requirements implemented (sde, feature layer, versioned - although not required).

I have tried both - auto save and manual save but edits are not saved.

Also the weird things is that after adding few points, fLayer.HasEdits returns false. What I am doing wrong or what I need to do to make it work?

Could somebody please help!

thanks in advance,
ajay -
0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor
How are you editing the FeatureLayer? Can you share some code? Also, you may want to subscribe to FeatureLayer EndSaveEdits and SaveEditsFailed events to see why save failed.

http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...

You can inspect EditResultItem from EndSaveEdits. http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.Edit...

or see the Error from TaskFailedEventArgs http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...

You can also run Fiddler with your app to monitor the web requests.
0 Kudos
AjaySisodia2
Emerging Contributor
hi Jennifer, thanks very much for your response.

I implemented the checks you mentioned.

I am getting this error:
{"error":{"code":400,"message":"Unable to complete  operation.","details":["Invalid graphic features","Invalid parameters"]}}

and the feature is: when added manually to the feature server.
[
{
"geometry":{"x":-9539817.27255194,"y":4613535.33509156,"spatialReference":{"wkid":102100}},
"attributes"{
"POIID":"113134"
}
}
]

i cleaned it up to remove the empty fields saved as null thinking that it may be that might be causing the issue, ex:
"ShortDescription":null,
"LongDescription":null,

The graphic point looks fine to me so not sure what is happening here. Any suggestion?
Do I need to change the spatial Reference?
0 Kudos
AjaySisodia2
Emerging Contributor
ok, i think i figured it out.

it adds the feature if the attributes ONLY with values are passed, so if request has some attribute such as "Description":null, it fails.

I have the custom form with DataContext=graphic.attributes and it loads all attributes in the form. The attributes not modified assume null values and hence passed at the time of feature save and then it fails.

I tried to use the updated fields list to explicitly save value as "" or remove it from the graphic but that  does not work either.

            foreach (KeyValuePair<string, object> kvp in _selectedPOI.Attributes)
                if (!dataEditorForm.updatedFieldsList.Contains(kvp.Key))
                    _selectedPOI.Attributes[kvp.Key] = "";
// OR             _selectedPOI.Attributes.Remove(kvp);

Any suggestions?
0 Kudos
PaoloTovar
Emerging Contributor
I had the same issue, i'm relatively new to silverlight but my particular issue was the feature service i was attempting to edit was based on a 3D feature dataset.
I create a new feature making sure there was no z and republished the service and it worked.

Hope this helps you,

Cheers!


Paolo
0 Kudos
AjaySisodia2
Emerging Contributor
hi Paolo:

Thanks for your response.

on researching it, also implementing the checks Jennifer recommended, i found that some field were set to not accept null in the db, fixing that solved the issue.

cheers,
ajay -
0 Kudos