Hi,
Problem
currently we are using the applyEdits function of the featureLayer.
Unfortunately we now face the following problem:
When this is sent via applyEdits the execution order seems random or maybe by uid.
This leads to the not-yet-main-address to be given the main-address attribute first before the main-address attribute is revoked from the original mainAddress.
Means there are two main-addresses at once violating the attribute rule and thus aborting the transaction.
ApplyEdits: FeatureService vs. FeatureLayer
We are using
featureLayer.applyEdits()There are two different applyEdits APIs:
Unfortunately they behave different.
The FeatureService offers this param:
FeatureServiceApplyEditsOptions.honorSequenceOfEditsWhich is not available for:
FeatureLayerApplyEditsOptions
Additionally their edits JSON are built differently as far as I understood documentation.
Searching for Solution
Workaround 1 (not suitable)
I would not like to split this into two different transactions. In case one excepts the other cannot be invalidated any more.
Question1
Is there any way to allow sequence order for featureLayer.applyEdits too?
Question2
How do I use FeatureService applyEdits in Arc JS? The FeatureLayer to perform for + applyEdits JSON from FeatureLayer.applyEdits is given
Examples I found so far only describe the FeatureLayer applyEdits.
I found this sample:
https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/applyEdits/
import { applyEdits } from '@esri/arcgis-rest-feature-service';
//
applyEdits({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0",
adds: [{
geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
attributes: { status: "alive" }
}],
updates: [{
attributes: { OBJECTID: 1004, status: "alive" }
}],
deletes: [862, 1548]
})
.then(response)
Question3
Is there may another way for the AttributeRule to be postponed to the end of the transaction after all edits were done in place but right before the changes will be persisted.
But the stated import does not work, erros are given, that it cannot be found.
I am using arcgisCore 4.34
Solved! Go to Solution.
@SebastianKrings wrote:gotcha
Maybe the doc should be extended by a sample showing the different means of multiple features within one "edit"-object and multiple "edit"-objects within the "edits"-array
Agreed! Not sure if we'll have time to get it into the 5.0 docs, but we added it to our task list.
--Rich
Maybe the doc should be extended by a sample showing the different means of multiple features within one "edit"-object and multiple "edit"-objects within the "edits"-array
@SebastianKringsI agree. We will update the documentation to clearly explain the difference between updating multiple features within a single edit object and using multiple edit objects within the edits array. We will also clarify how honorSequenceOfEdits works and when it should be used.
Thank you for the quick response.
The REST request looks fine to me, and suggests maybe there is a problem on the server. I'm going to try to reproduce it on my end, and will get back to you here. If I cannot reproduce it, I'll probably need you to submit something to technical support.
("Exclude from application evaluation" controls whether or not Pro or Native Maps SDK applications will try to revaluate the rule on the client before sending it to the server. JavaScript never does this, so changing this setting has no impact on a JavaScript client)
--Rich