This should be simple... Editing a Feature Layer

370
0
10-12-2023 02:05 PM
WillStonehouse
New Contributor

All I want to do is to be able to edit the attribute in a Feature Layer and use applyEdits to save the changes using WebApp Builder and API 3.X. Everything has worked UNTIL I use applyEdits.

The applyEdits function doesn't even execute.

If you can't help debugging, can someone just show me an example of how to query an attribute from a point from a Feature Layer, change it, then apply the change? This would help tremendously! Here's one of many different versions of what I tried.

altLayer.queryFeatures(altquery, function (result) {

          var featuresToUpdate = result.features;

          var featuresToUpdate_ = featuresToUpdate[0];

          featuresToUpdate_.attributes['unitCountStr'] = “88”;

            altLayer.applyEdits(null, featuresToUpdate, null, function (addResults, updateResults, deleteResults) {

              if (updateResults[0].success) {

                console.log("Attribute updated successfully");

              } else {

                console.error("Failed to update attribute");

              }

            });

          });

0 Kudos
0 Replies