Skip navigation
All Places > Survey123 for ArcGIS > Blog > Author: JTedrick-esristaff

When you have a multiple choice question in a survey, have you wondered why the data in a popup looks different than in the form?

 

When Survey123 publishes a single choice question, by default it takes advantage of geodatabase domains to write the default label into the feature layer as well – this allows the label to appear automatically in popups in the Map Viewer and other applications in your ArcGIS Organization. 

 

With multiple choice questions, this is more difficult.  Survey123 stores multiple choice questions as comma-separated values in a text field.  That means there isn’t a built-in way to view labels for these questions. 

 

However, Arcade can be used to take the values stored and substitute appropriate labels.  Arcade is a cross-platform expression language for ArcGIS, and is currently supported in web map pop-ups and ArcGIS Pro.  Previously, Carmel Connolly showed how to use Arcade with ‘other’ choices in questions.  For multiple choice label substitution, a template attribute expression is available at the Esri’s Arcade Expressions GitHub repository; you will need to enter in: 

  • The name of multiple-choice question’s field 
  • The list of values and labels to be substituted 

 

// Replace the field name here 
var fieldName = "like_fruits";
 
// Replace the choices here 
var choices = {}; 
choices['apple'] = 'Apple   '; 
choices['banana'] = 'Banana   '; 
choices['grapes'] = 'Grapes   '; 
choices['kiwi'] = 'Kiwi   '; 
choices['orange'] = 'Orange   '; 
choices['peach'] = 'Peach   '; 
choices['strawberry'] = 'Strawberry   '; 

function formatLabels(inText) { 
    return Concatenate("", inText); 
} 

function formatMulti(inField, d) { 
    var values = Split(inField, ','); 
    var labels = []; 
    for (var i in values){ 
        labels[i] = formatLabels(d[values[i]]); 
    } 
    var outText = Concatenate(labels, TextFormatting.NewLine); 
    return outText; 
} 

formatMulti($feature[fieldName], choices);


You can see this expression in this webmap.

Hi all,

 

I wanted to let everyone know that we've updated the Survey123 Beta Program with a new version of Survey123.  This release includes several fixes as well as initial testing support for a new functionality - webhooks. Webhooks are a configuration option that will allow Survey123 to accomplish a second action when submitting a survey; for example, sending an e-mail with some of the submitted information.  If you're interested in trying this out, please enroll in the Early Adopter Community!

 

The Esri Early Adopter Community enables our users to to test early versions of upcoming releases of Esri applications.  Survey123 publishes beta versions of the software during every development cycle to test and try out new features.  If you're interested in trying out new functionality and fixes, please enroll using the link above!

With the 2.4 release of Survey123 Connect, a null value is now supported in the bind::esri:fieldType column of an XLSFormWhen the field type is null, Survey123 Connect will not create a field when publishing.  I’d like to highlight 3 cases where this can really enhance your forms: 

  1. Intermediate Calculations 
  2. Multiple Geopoints 
  3. More easily match an existing feature services 

 

Intermediate Calculations 

When doing a set of complex calculations, it’s often easier to break out sub calculations into their own question to make them more manageable.  While this was easier for you as a survey author to manage, this meant that you would have these intermediate steps stored in the database.  By assigning these the null field type, we simplify the data being stored to only the final calculations. 

For example, this Excel sheet calculates the linear regression of three observations. This involves a number of intermediate calculations, beginning with calculating the mean value of X & Y and then the distance an observation is from the mean value. 

 

Multiple Geopoints 

Form with 2 points

Another popular request the null value solves is the ability to capture multiple locations in a form; one location can be stored as the geometry of the feature with the other points being stored in x & y fields. Note that as the survey submission needs to have a geometry, you must have 1 geopoint question not set to null.

 

An example where multiple geopoints are useful is when collecting the location of a culvert or other relatively straight linear asset.   

To store the point information, get started by creating 3 (or more) questions for each point after the first: 

  1. The geopoint question to record the value 
  2. Two decimal (or calculate/hidden) questions to store the points x and y values (add additional fields for z and accuracy, if desired) 

Set the field type to null for the geopoint and use the pulldata(‘@geopoint’) function to extract the value after the point is set.  Here's a basic sample with a start and end point. 

 

Matching an existing feature service 

While Survey123 can automatically create a form based on an existing feature service, it may not create the form you quite want.  For example, a field storing how long someone has lived at a place might be better shown on the form by asking when did they move in – the length of time can then be calculated.  By creating a separate question to be asked with the null field type, you can create some flexibility between what is asked and the data that gets stored. 

 

Have another use for the null field type? Share in the comments below! 

 

 

 

Survey123 for ArcGIS lets capture photos anywhere in your survey.  These photos can then be accessed via several online and desktop tools.

Viewing your Photos

In ArcGIS terms, photos are attachments stored in the feature service’s database along with the rest of the survey data submitted.  There are a couple ways of exploring the images through the web:

  • The Data tab of the Survey123 for ArcGIS’s website displays the photos of a survey response when it is selected in the ‘Individual Response’
  • Sign in to your ArcGIS organization (for example https://www.arcgis.com) and you can view the data table of the service storing the data, including accessing the image attachments.  To do so, go to the Item Details of the service storing your form data and go to the ‘Data’ tab.
  • Links to attached photos can be displayed in the pop-ups of a survey point in a web map be available in a web application like a Story Map.

Exporting your Photos

Aside from having the photos stored with the survey data, there are analysis operations that may require the photos to be downloaded; for example, archiving the photos or using them in documentation/presentations.  Any individual photo can be downloaded from web sites by right-clicking on the photo and selecting ‘Save Image’ or right-clicking on the link and selecting ‘Download Link(ed File)’.  The most efficient way to export all of the photos is to download a File Geodatabase copy of the data and then follow the steps described in the Esri Knowledge Base article "How To: Batch export attachments from a feature class". Note that this will also download any signature question answers as well; signature questions will not have location information embedded.

Photo Metadata

When you take a photo, Survey123 records more than just the picture.  Photo metadata (camera type, camera settings and location information) are stored in what is known as the EXIF portion of the photo file. The location information in particular can enhance the understanding of a survey by providing additional points that can be associated with the survey.  A good example of this is inventorying equipment and facilities at a local park.  We can construct a form with the questions, including a photo, for the equipment are in a repeat of a form that gets filled out once per park.  Rather than asking for a point at every piece of an equipment, the collector can take a photo, from which the approximate location can be extracted.  The result is that the survey is recording multiple points without users needing to always add information onto the map.

To get the location information, the survey data must be downloaded as described above.  ArcMap and ArcGIS Pro both have a “GeoTagged Photos To Points” tool that then will create the new point features.  To make this process a little easier, I’ve combined the extract tool with the GeoTagged Photos to Points tool in Python Script and Toolbox.

As you may know Survey123 for ArcGIS creates its own feature service when creating a survey. This exists in either ArcGIS Online's or your Portal's Hosted Data. From there, the data can be downloaded as a File Geodatabase easily. This makes it possible to import the data into a geodatabase, though this works best as a one-time import. To help synchronize an enterprise geodatabase with an on-going survey, we're introducing a Python Script and ArcGIS Toolbox Tool, available on ArcGIS Online. You may choose to use this as a one-type migration or as part of an ongoing data synchronization routine.

 

This script does the following:

  • Log in to ArcGIS Online and download the survey database
  • If needed, create the tables in the enterprise geodatabase to store the data
  • If applicable, filter out records that have already been synchronized over
  • Copy over the data from the database maintaining attachments and relationships

This was authored with ArcGIS Desktop 10.4, but will work with ArcGIS Desktop 10.3 if the pytz python module is installed.

Parameters used by the tool

The following parameters are needed:

  • SDE Connection File | File Geodatabase: Either a .sde file that connects to the destination database or a File Geodatabase
  • Table Prefix: The tables are created will have the prefix applied before the name of the table (i.e., if the prefix is 's123', a table in the service with the name 'myform' will be imported as 's123myform'). This is to prevent the chance of accidentally overwriting tables of the same name. This needs to be unique per survey.
  • Feature Service URL: the url to the Feature Service endpoint. This is the endpoint for the Service, not an individual layer (i.e., it will end with '/FeatureServer' with no numbers)
  • Time Zone: Dates in ArcGIS Online are stored in UTC time; python processes by default without a time zone. The time zone parameter is needed to calculate the difference. The time zones are specificed in this list
  • Portal: either 'https://www.arcgis.com' for ArcGIS Online or the Portal's url
  • Username: your username for ArcGIS Online / Portal
  • Password: your password for ArcGIS Online / Portal. If you don't supply it, you'll be prompted by the script after it starts

If you run the geoprocessing tool in ArcMap and are already signed into to your ArcGIS organization, the script will use that information instead of the Portal, Username and Password parameters.

How to use the script

There are three ways to use the script:

  • ArcGIS Script tool: This provides a graphical interface to the tool using ArcGIS Desktop. If you have an enterprise login, first sign into ArcGIS Online or your Portal for ArcGIS, within ArcGIS Desktop.
  • Command line: Invoked with parameters specified. The usage in this case is:
    python syncSurvey.py <SDE Connection File | File Geodatabase> <Table Prefix> <Feature Service Url> <Time Zone> <Portal> <Username> [Password]
  • Using a config file: The parameters above can be stored in a text file and read by the script, making automated syncronization jobs easier. To run in this mode, use the following syntax:
    python syncSurvey.py CONFIG <path to config file> <section name>.
    The config file has the following format:

[SECTION_NAME]

portal: https://www.arcgis.com

username:

password:

service_url:

sde_conn: <The path to a .sde file that connects to the destination DB OR a File GDB>

prefix: s123

timezone: US/Pacific

With the 1.7 release of Survey123 for ArcGIS, we introduced a function that makes it easy to access data that is external to the survey- pulldata(). Using this function, can have a set of reference information distributed with the survey, making it easy for your respondents to enter information that doesn't change very often or is used as a baseline data point in your survey.

 

Preparing your data

The pulldata() function relies on your external data being stored in a CSV file and uploaded as part of your survey. This means that you can easily generate the data file from a wide variety of tools, including Microsoft Excel and ArcGIS Desktop. Place the CSV file in the media folder, the same place where all external files (video, audio) go.

 

Using pulldata() in your form

The full function and its parameters are pulldata(<csvfile>, <returnColumn>, <lookupColumn>, <lookupValue>).

  • csvfile is the name of the external data file without the .csv ending.  As mentioned above, it is stored in the media folder of the survey
  • returnColumn is the column in the CSV file with the value you want to be entered into the form.
  • lookupColumn is the column in the CSV file with the value you have from the form to find the correct row
  • lookupValue is the value in form that exists in the CSV file to find the correct row.

 

Example: Fish Size calculation

A common task in wildlife management is to conduct a survey of plant and animal specimens. Management of fish, in particular, factors in the size and weight of the fish to determine maturity and capture potential. The 'standard weight' of a fish can be roughly modeled against its length using a density function. The function is given as: 

Weight = a*Length^b.

We can compare this weight against the actual weight to provide a quick evaluation of fish health; under 80% of standard weight may indicate the fish is under stress.

 

The values of a and b vary between fish species. Rather than embed a set value for all fish in the survey itself, we can use an external data to store the values of a and b for each fish species, and then read the values using pulldata.

To implement this, we first have a table that stores the a and b values, along with an identifier for the fish.

codelabelab
BCFBlue catfish0.0000015533.278
BCRBlack crappie0.0000159592.968
BLGBluegill0.0000035923.304
BRBBrown bullhead0.0000633872.711

FishCalc.csv - table of standard weight parameters 


In our form, we then use the pulldata function to retrieve the values. We could use the pulldata function directly in the calculation, but for clarity, I'll use separate note questions to retrieve the values and then use them in a third question that calculates the weight:

 

typenamelabelappearancereadonlydefaultcalculation
textstationStation Location
datedateDate Sampledtoday()
begin repeatfish_repeatFish Data
select_one speciesspeciesChoose Speciesminimal
decimallengthIndividual length
decimalweightMeasured weight
noteaValue for a:pulldata('FishCalc', 'a', 'code', ${species})
notebValue for b:pulldata('FishCalc', 'b', 'code', ${species})
notestdWeightStandard Weight:round(${a} * pow(${length}, ${b}),3)
decimalshowknWeight / Standard Weightyes${weight} div ${stdWeight}
end repeat

FishEntry.xls - sample XLS form that uses pulldata to calculate standard weight for fish

 

The full form template can be downloaded to try. Thank you to the Georgia Department of Natural Resources, who provided the original values used in this form.


What type of data is a good fit for pulldata()?

The data used by pulldata() is published at the same time as the form. Because of this, the data used in pulldata functions shouldn't change too frequently. In the above example of estimating fish weight, this information would rarely change, if ever. The data can be updated by republishing the form with new data; but the field workers then need to update the forms on their devices. This suggests that the data that is used should be updated less than the typical cycle that the field workers would update the form. If you have your field workers check in every morning, for example, data that is updated once a day or less would be appropriate.

 

More uses for pulldata()

The example in this blog used the CSV file to store variables in a function; other similar uses include being able to estimate crop yield based on crop or seed type and acreage or total allowable development based on land use zoning and approximate lot dimensions. Another type of survey that benefits greatly from pulldata is a periodic inspection, such as bridge, hydrant or household address verification.  The CSV file can contain the data from the last time the inspection and then filled into the format a baseline for the updated inspection.  Some operations, such as post-disaster recovery, may include multiple rounds of surveys- a preliminary damage assessment, a more thorough building assessment after the immediate disaster, and post-disaster followups.  The data from previous surveys can accompany subsequent rounds of surveys as reference and a consistency check for the surveyors.  In addition to calculations, the pulldata function can also be used in a constraint to validate the value matches (or is within a range of) the existing value.

 

Learning more

The Survey123 for ArcGIS help has a section describing the use of pulldata.

We've also posted a tutorial video on CSV file and pulldata use in the Survey123 for ArcGIS playlist on YouTube.  

If you have any additional questions, please ask in the Survey123 for ArcGIS community in GeoNet!

You've collected your data using Survey123 for ArcGIS, what's next? There are several ways the Survey123 website can help you analyze and visualize the results of your survey.  The Analyze tab enables some great reporting capabilities that help you review, understand, and interpret your survey results. It provides some simple, but very powerful reporting tools such as making charts, word clouds, etc. These tools can help you better interpret your survey results.

 

Viewing Results - The Analyze tab

At the Analyze tab of a survey, you can view the aggregate results of your survey- each question, aside from image questions, will display a chart. Depending on the data type, the charts available will be different:

  • Text (free text): The most common words by count will be displayed as a word cloud (requires at least 20 entries)
    Word cloud visualization of a text field
  • Single Choice Questions: Column, Bar, and Pie charts, as well as a map color-coded by answer
    Column chart visualiztionBar chart visualizationPie chart visualizationMap of points categorized by field being visualized
  • Multiple Choice Questions: Column, Bar
  • Date questions: Histogram
    Histogram visualization of date field

PrintingCharts can be printed as displayed; this also allows for PDF export on many computers

From the Analyze tab, you can print your entire survey summary results as a PDF file. You can alternatively hide questions from your report using the 'Visibility' setting. When ready to print, use the 'Print Current View'; if your browser supports PDF generation, you can then save the result to a PDF file.

'Set Visibility' option in analyze tab controls which charts are displayed

 

With the latest update to the Survey123 website we also have enabled the printing of individual responses. In the 'Data' tab is now the option to view the details of a response. From there you can print that detail or save as a PDF file.

 

What will we improve?
Looking forward, an area we are working on is providing additional capabilities to filter survey data totals to be able to see statistics based on the values of questions or submission time. We also want to support bulk printing of records.

 

We also want  to enable you to share  the survey results with groups of people. At the moment, only the owner of the survey can look at the analyze tab.

 

Try out the Analyze tab, Detail view, and printing and let us know what you think!