Hi All - I want to update a feature attribute that are already being present in the geodatabase with a JSON format.
Below is the detailed explanation of my above statement.
1. I have a bunch of features in a database in a feature class
2. I have a feature access layer with the respective feature class
3. I have a JSON File which is having a unique identifier as a input and respective Attribute to update.
Example :
{
"Update": [{
"UID": "12345",
"Attribute": "Completed"
}, {
"UID": "3456",
"Attribute": "Pending"
}]
}
4. How can I loop through the features and update the respective UID of the feature with the desired attribute ?
I have tried with the Apply Edits and have no success over it ? Can someone please suggest.
Raviteja,
The applyEdits function is exactly what you need to be using. Can you share your coding attempts to use applyEdits, so that we can try and find your issue?
1. make query on the feature layer and select the features you want to update
2. loop on the result set
3. for each feature applyEdits
layerForEdit.applyEdits(null, [newGraphic], null, successApplyGeometry, failApplyGeometry);
4. newGraphic must have the same ObjectID with the selected in order to find and update the correct feature.
so try the same with objectid on the Graphic's attribute list.