validateRelationshipConstraints method
- {required ArcGISFeature feature}
Validates constraints for a given feature participating in a relationship.
The following are considered violations:
- In a composite relationship, adding an orphan feature to the destination table without relating it to an origin feature
- Cardinality Violations:
- In 1:1 relationships, if an origin feature is already related to a destination feature, relating another feature to either of them
- In 1:n relationships, relating a destination feature to more than one origin feature
To recover from an orphaned destination feature violation, simply relate it to a valid origin feature, using ArcGISFeature.relateFeature. You can usually recover from a cardinality violation by removing the relationship between the appropriate features, using ArcGISFeature.unrelateFeature
Note that edit operations do not error when there are constraint violations. This allows you to recover from violations in a back office operation after applying edits or syncing, if you choose to do so. See ArcGIS Desktop Validate Features process here.
Note: This method makes network calls to query for the related features if they are not present locally. If you have just related the feature you are validating, you need to first call FeatureTable.updateFeature to reflect the modified attribute value in the table. If this is not done, validation results may be incorrect.
Parameters:
feature
— The feature.
Return Value: A task that represents the asynchronous validation of
relationship constraints operation. The value of the task result contains
a RelationshipConstraintViolationType
object.
Implementation
Future<RelationshipConstraintViolationType> validateRelationshipConstraints(
{required ArcGISFeature feature}) {
final taskHandle = _withThrowingErrorHandler((errorHandler) {
return runtimecore
.RT_ArcGISFeatureTable_validateRelationshipConstraintsAsync(
_handle, feature._handle, errorHandler);
});
return taskHandle.toFuture(
(element) => element.getValueAsRelationshipConstraintViolationType()!);
}