0

I have a feature service with an SOI. The SOI automatically calculates some field values for new features. The SOI itself works fine. However arcgis online maps are not aware of the autocalulated fields after a new feature has been created, the attributes show up null values. It takes a map refresh or several pans for the new attributes to show up. Worse still is that if an editor updates the new feature before it has been refreshed from the server the autocalulated values are overwritten back to null.

Is there a way to force apps to not cache layers after an edit? I also looked at the responseProperties parameter of the SOI request handler but from what I can see the only options are success or failure, there is now way to pass the updated feature.

2

You can setup a refresh interval on the layer within the map so it refreshes itself within a defined time limit so you do not have to refresh the entire page.

  • Interesting, where do I find this setting? – Dowlers Aug 4 '17 at 17:30
  • On the feature layer in the map viewer, click the three little dots and towards the bottom of the overflow menu you will see refresh interval. – Russ Roberts Aug 4 '17 at 19:11
  • Unfortunately this setting won't fit in our workflow. The time between creating a feature and editing its attributes will be a lot less that 1 minute. If there was an option to refresh after edit that would be perfect. – Dowlers Aug 4 '17 at 20:50
0

The answer I came up with was to remove the JSON tokens that were overwriting the fields. For some reason update calls from the javascript widget include all the attributes of a feature, not just those that are being updated.

I altered the SOI to listen for update events and parsed the operationInput parameter. Edits to new features had null values for the attributes I had auto calculated. Removing these tokens from the JSON string prevented the update overwriting them.

jobj = JObject.Parse(operationInput);
JToken token = jobj["updates"][0]["attributes"]["AssetID"];
if (token.Type == JTokenType.Null )
{
       jID = (JObject)jobj["updates"][0]["attributes"];
       jID.Property("AssetID").Remove();
}
byte[] bb;
bb = restRequestHandler.HandleRESTRequest(
                    Capabilities, resourceName, operationName, jobj.ToString(formatting: Newtonsoft.Json.Formatting.None),
                    outputFormat, requestProperties, out responseProperties);
return bb;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.