| Numéro d’ID de bogue |
BUG-000099984 |
| Envoi | October 10, 2016 |
| Dernière modification | April 22, 2025 |
| S’applique à | ArcGIS Runtime SDK |
| Version trouvée | 10.2.6 |
| Système d’exploitation | Windows OS |
| Version du système d’exploitation | 7.0 64 Bit |
| Statut | Non-Reproducible
Ce problème n’a pas pu être reproduit au cours des tests réalisés par l’équipe de développement. Ce statut peut être attribué aux problèmes qui sont impossibles à reproduire ou qui ne sont plus d’actualité dans une version de développement du logiciel, alors qu’aucun correctif spécifique n’a été installé pour résoudre le problème. Pour d’autres explications, reportez-vous à la section Informations supplémentaires correspondant au problème.
|
Informations supplémentaires
This is working as expected. The code was incorrect in the way it was written. A couple of points to take into account:
1. The attachmentId is initially a negative number when it is local. Since absValue was being used, it made things confusing. When a feature didn't have any attachment, the API assigned a value of -10 as the attachmentId. But once it had at least one attachment, the attachmentId was looked up for the previous attachment, and then the new attachment was being assigned a new incremented id but again a negative number. Hence the confusion.
2. The correct way to do it is to call applyAttachmentEdits (async), connect to the complete signal for it, and there requery for the attachements and look up the correct id (I have the code for it below).
3. In Quartz 100.0.0, the API is much cleaner and you would do all of these using the attachmentListModel and you can configure it so that it autorefreshes and you will always have the correct id without having to write all the code yourself. The API does the heavy work in the back end.
Updated Code:
Query {
id: query
where: "id=" + selectedFeatureId
}
GeodatabaseFeatureServiceTable {
id: featureServiceTable
url: "http://54.194.53.236:6080/arcgis/rest/services/Visit_Gozo/Visit_Gozo/FeatureServer/4"
// url: "https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"
onAddAttachmentStatusChanged: {
if(addAttachmentStatus === Enums.AttachmentEditStatusCompleted) {
console.log("Temp attachment id: ", addAttachmentResult.attachmentObjectId);
console.log("Feature Id: ", addAttachmentResult.objectId);
console.log(addAttachmentResult.isSuccess);
// call apply edits
featureLayer.featureTable.applyAttachmentEdits();
}
if(addAttachmentStatus == Enums.AttachmentEditStatusErrored) {
console.log("Error! Error!");
}
}
onApplyAttachmentEditsStatusChanged: {
if(applyAttachmentEditsStatus === Enums.AttachmentEditStatusCompleted) {
// requery to get the correct attachment id's
queryAttachmentInfos(selectedFeatureId);
}
}
onQueryAttachmentInfosStatusChanged: {
if (queryAttachmentInfosStatus === Enums.QueryAttachmentInfosStatusCompleted) {
for (var i = 0; i < attachmentInfos.length; i++) {
console.log(JSON.stringify(attachmentInfos[i]));
console.log("AttachmentId: ", attachmentInfos[i]["attachmentId"]);
}
}
}
}
Étapes pour reproduire
ID de bogue: BUG-000099984
Logiciel: