I need to reset all the values in a field for all the features in a feature service. Just like the field Calculator in ArcMAP. Basically push a button and a whole field gets reset?
Any ideas?
In one of my apps, I use applyEdits to update a collection of features (featureSet) with the click of a button. The user selected the new attributes from a series of combo boxes and clicked the button. In the button click function, my code looked like this
array.forEach(featureSet, function (feature) { feature.attributes.Priority = registry.byId('cboPriority').get("value"); feature.attributes.Management = registry.byId('cboManagement').get("value"); feature.attributes.Criteria = registry.byId('cboCriteria').get("value"); }); layerFeatureLayer.applyEdits(null, featureSet, null, function () { console.log("Features updated!"); }, function (error) { console.log("Features not updated! ", error); }); <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
That worked! Thanks Ken!
Did a query to select all features then ran that array. Thank you
Paul,
You have to provide an array containing each graphic (that is why I said that this is not easily done with JS API);
Thanks For the Reply Robert,
With the FeatureLayer.applyEdits is there a way to do all of the features at once or will I have to do each OBJECTID individually?
This is not something that can be easily done in JS API. Your possibilities are to use FeatureLayer.applyEdits or create a GP service fro this.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.