Hi,
Problem
currently we are using the applyEdits function of the featureLayer.
Unfortunately we now face the following problem:
- There is an object which may consists of multiple addresses.
- only one address can be the main-address
- main-address can be switched to another non-main-address
- there is an attribute rule checking that there is at most one main-address
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:
- FeatureService
- FeautreLayer
Unfortunately they behave different.
The FeatureService offers this param:
FeatureServiceApplyEditsOptions.honorSequenceOfEdits
Which 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