laptop and a wrench

Bogue

In ArcGIS Maps SDK for .NET, synchronizing an edited feature with a related record from client A's device that was previously deleted & synced from client B's device will upload the feature from client A but the related record is missing.

ArcGIS Maps SDK for .NET
Numéro d’ID de bogue BUG-000172341
EnvoiNovember 15, 2024
Dernière modificationFebruary 2, 2025
S’applique àArcGIS Maps SDK for .NET
Version trouvée200.5
Système d’exploitationWindows OS
Version du système d’exploitation10.0 64 Bit
StatutIn Review

Solution de contournement

To counteract the potential missing related record from Client B's sync,

  1. Perform a query on the related table to obtain the related records from the mobile geodatabase.
  2. Take the related record(s) to re-update the related table. Because deleting a feature from client A removes its related records, the app needs to re-update the related table before performing client B's sync.
  3. Next, relate the selected feature from the primary table to the related feature(s) from the query result (step 1) using the RelateFeature method to ensure that both records stay related as emphasized in the documentation link: https://developers.arcgis.com/net/edit-features/relate-features/#relate-two-features
  4. After Client B performs a sync, both the primary feature and its related record appeared in the attribute table. Additionally, the created_user field name remains unchanged from the initial edit session while the last_edited_user field name reflects the correct value from Client B.

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);

}

Étapes pour reproduire

ID de bogue: BUG-000172341

Logiciel:

  • ArcGIS Maps SDK for .NET

Recevoir une notification lorsque le statut d’un bogue change

Télécharger l’application Esri Support

En savoir plus sur ce sujet

Obtenir de l’aide auprès des experts ArcGIS

Contacter le support technique

Télécharger l’application Esri Support

Accéder aux options de téléchargement