How to download all the photos only of the selected surveys and not all surveys.

730
6
01-11-2019 08:53 AM
ChristopherVan_de_Wyngard
New Contributor II

When a record is selected I have tried to do a File Geodatabase export and it downloads all the records not just one or two being selected.

0 Kudos
6 Replies
BrandonArmstrong
Esri Regular Contributor

Hi Christopher,

Are you using the method highlighted in the screenshot below?  I just tested by selecting once record and exporting, which worked as expected.

0 Kudos
ChristopherVan_de_Wyngard
New Contributor II

Brandon,

I verified that I was using the method as highlighted in the screenshot and when I download a File Geodatabase it downloads all the images from all records.

My method is to make sure that the “Selected records only” is selected, that only one record is selected, and then I click download “File Geodatabase”. Then I run the ArcMap script to get photos and it pulls all the photos for all records.

Thanks,

Chris

0 Kudos
BrandonArmstrong
Esri Regular Contributor

So, when you add the feature class from the exported file geodatabase to ArcMap, records other than those that were selected are present?  Which ArcMap script are you referring too?

Thanks,

Brandon

0 Kudos
ChristopherVan_de_Wyngard
New Contributor II

The script that I am currently using is the one recommended by survey123, the arcpy code is below. When I use ArcMap to pull the images from the geodatabase then I still pull all the images from all the records and not just the one selected originally.

import arcpy

from arcpy import da

import os

inTable = arcpy.GetParameterAsText(0)

fileLocation = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable, ) as cursor:

for item in cursor:

attachment = item[0]

filenum = "ATT" + str(item[2]) + "_"

filename = filenum + str(item[1])

open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())

del item

del filenum

del filename

del attachment

0 Kudos
BrandonArmstrong
Esri Regular Contributor

Thank you for clarifying, Chris.

As it turns out, the selection of records on the parent layer in the Survey123 website does not currently correspond to the the related table storing the attachments. This is why the exported related table contains all attachments within the related table. 

We do have an open issue for this functionality and we are looking to include it in a future release of the Survey123 website. I have added your comments to the issue and will update you when this changes.

Best,

Brandon

ChristopherVan_de_Wyngard
New Contributor II

Thanks Brandon,

I look forward for the future release of the Survey123.

Thanks for your time,

Chris