AnsweredAssumed Answered

Having trouble Viewing/Adding Attachments

Question asked by Caleb1987 on Nov 16, 2015
Latest reply on Aug 8, 2016 by GWaltersesriaustralia-com-au-esridist

This is my first attempt at making an App with the ArcGIS Runtime SDK for Qt and App Studio.  I've been loosely following QML code examples found in the ArcGIS Runtime team's sample app and Lucas Danzinger's repo on GitHub for the San Diego Brewery Explorer.  The first problem I'm having is that I cannot return the attachments of a GeodatabaseFeature using the attachmentModel property.

 

In the screenshot below I am doing an identify against a feature service point (OID 1060) that has one attachment.  The identify is working but I cannot seem to fill the combobox with the list of attachment images:

 

identifyError.png

Another weird thing that happens here is the Latitude and Longitude (both double) values are showing up as undefined even when valid coordinates are added to the table and using the toString() method on them while building the list of fields throws an error.  However, I am more concerned about getting the attachments to show up.  The entire project code is attached.  But from the screenshot, you can see the console log is reporting that the selectedFeature is valid as it logs the resulting JSON, but for some reason the attachment count is coming back empty.

 

The second problem I am having is with adding attachments.  Below is my form.  It lets me select a file for attachment (currently only testing on Windows) and on the onAccepted() signal, the console logs the name, size and url of attachment (this comes back undefined which makes sense) by using:

 

console.log("GDB Attachment: " + geodatabaseAttachment.name + ", " + geodatabaseAttachment.size + ", " + geodatabaseAttachment.url);

 

formAttachment.PNG

 

And here I am getting an error that there is a problem adding the attachment.  On the onApplyAttachmentEditsStatusChanged() signal I am also not able to pull the errors as I get an empty JSON object.  I am probably doing some thing wrong there too:

 

attachmentError.PNG

In all the code samples I've seen, a new GeodatabaseAttachment is created like this:

 

var geodatabaseAttachment = ArcGISRuntime.createObject("GeodatabaseAttachment");

 

However, for some reason I am unable to import the ArcGIS.Runtime 10.26 module and I get this error:

 

file:///C:/Users/calebma/ArcGIS/AppStudio/Apps/f2fed33a81d74109b4ec4a8b03eec5d1/Empty.qml:17:1: plugin cannot be loaded for module "ArcGIS.Runtime": Cannot load library C:/Users/calebma/Applications/ArcGIS/AppStudio/bin/qml/ArcGIS/Runtime.10.26/ArcGISRuntimePlugin.dll: The specified module could not be found.

     import ArcGIS.Runtime 10.26

     ^

In the attached project, the "Empty.qml" is the main file and the "EditWindow.qml" is the source code for the edit form.  By default when you add a new sighting it tries to grab your device position, if not you can manually add a point.  For testing, you can uncomment line 82 to disable using the device location.  Also, this was built using App Studio with the "Toolbar and single content area" layout template if that helps.  If anyone could help me out I would greatly appreciate it!

 

Also, if anyone has any good code examples of how to add a legend with the ability to toggle layers on/off that would be a bonus!  Thanks.

Outcomes