Bogue
Numéro d’ID de bogue | BUG-000172341 |
---|---|
Envoi | November 15, 2024 |
Dernière modification | February 2, 2025 |
S’applique à | ArcGIS Maps SDK for .NET |
Version trouvée | 200.5 |
Système d’exploitation | Windows OS |
Version du système d’exploitation | 10.0 64 Bit |
Statut | In Review |
To counteract the potential missing related record from Client B's sync,
Although the code snippet below is not a complete algorithm to copy-paste, part of the code can be used in a test app.
-----Code Snippet-----
ArcGISFeatureTable relatedTable = null;
GeodatabaseFeatureTable featureTable = null;
FeatureQueryResult result = null;
Geodatabase _resultGdb = await Geodatabase.OpenAsync(_gdbPath);
// Loading primary feature table and related table
foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables)
{
await table.LoadAsync();
if(table.LoadStatus == LoadStatus.Loaded)
{
if (table.GeometryType == GeometryType.Point)
{
featureTable = table;
}
else if (!table.HasGeometry)
{
ArcGISFeatureTable relatedTable relatedTable = table;
await relatedTable.LoadAsync();
}
}
}
QueryParameters queryParams = new QueryParameters
{
Geometry = selectionEnvelope,
MaxFeatures = 1
};
// Selecting feature to obtain attribute data
result = await layer.SelectFeaturesAsync(queryParams, Esri.ArcGISRuntime.Mapping.SelectionMode.New);
Feature feature = result.First();
feature.SetAttributeValue(AttributeLabelFieldInput.Text, AttributeLabelFieldValue.Text);
// Primary attribute field name shares the same attribute data/value with the related record
var relatedFieldValue = feature.GetAttributeValue("PrimaryAttributeFieldName");
// Perform a query on the related table using the field name and value in the where clause
var query = new QueryParameters()
{
WhereClause = $"RelatedFieldName = '{relatedFieldValue}'"
};
// Query result from the related table is used to re-update the related table
// Query result is also used to relate the feature from the primary feature table to the feature from the related table
// Primary feature table is then updated before performing a sync
FeatureQueryResult relatedFeatures = await relatedTable.QueryFeaturesAsync(query);
if (relatedFeatures != null)
{
ArcGISFeature arcGISFeature = (ArcGISFeature)feature;
foreach (ArcGISFeature relatedFeature in relatedFeatures)
{
await relatedTable.UpdateFeatureAsync(relatedFeature);
arcGISFeature.RelateFeature(relatedFeature);
}
await featureTable.UpdateFeatureAsync(arcGISFeature);
}
ID de bogue: BUG-000172341
Logiciel:
Obtenir de l’aide auprès des experts ArcGIS
Télécharger l’application Esri Support