Select to view content in your preferred language

Drop down list from another layer

101
4
yesterday
Crystal_Cowardin
New Contributor

I have a layer that users will use Field Maps to collect data for.  They need to collect an address.  I would like the address field to be a drop down that they have to choose from.  Our addresses come from another layer with about 150,000 entries. How would I go about doing this?  I've only done it with creating my domain list manually. 

0 Kudos
4 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @Crystal_Cowardin,

So there are several ways to go about this but it depends on the type of feature (hosted vs reference).

  1. For hosted service using fields calculation: You can create a field calculation to automatically pull in the closest address point upon an update.
  2. For Enterprise FS: similar to the field map calculation, create an attribute rule that populates the closest address point.
  3. For Both you can use python to modify lookup values. This can be done by either populating a table of values and then running the table to domain tool or directly updating the domain codes and values.
Crystal_Cowardin
New Contributor

Thank you for these options.  They may be above my skill level but I'll look into the attribute rule option since my feature layer is referenced. 

Someone did a similar project in my office and used Survey123 Connect instead of Field Maps so may look at that also.

0 Kudos
RhettZufelt
MVP Notable Contributor

I use python to do this for my street names.  First, I create a dictionary, then I use arcpy.da.SearchCursor to populate it with my street Code:Value pairs: (I don't have a street called "Pathway" in the source table, so below is how I 'add' it to the list)

import arcpy

update_dict = {"fields": [
   {
     "name": fieldname,
     "domain" :{"type" : "codedValue", "name" : domainname,
     "codedValues" :[
{"name" : "Pathway", "code"  :  "Pathway"}
]}}]}


with arcpy.da.SearchCursor('streetsFC', ["Code","Street"]) as cursor:
        for row in cursor:
            update_dict['fields'][0]['domain']['codedValues'] += [{"name" : row[0] , "code" :  row[1]}]

dictionary format is as follows:

update_dict = {"fields": [
   {
     "name": "StreetName",
     "domain" :{"type" : "codedValue", "name" : "Streetnames",
     "codedValues" :[
{"name" : "10th Ave", "code" : "10th Ave"},
{"name" : "10th St", "code" : "10th St"},
{"name" : "First St", "code" : "First  St"}
      ]}}]}

Then I use the python API to update the domain list on the HFL in AGOL:

from arcgis.gis import GIS
my_agol = GIS(url='https://yourorg.maps.arcgis.com', username='adminuser', password='adminpass')

lyr = my_agol.content.get('ItemIdNumber').layers[0] 
update = lyr.manager.update_definition(update_dict)

 Not sure how responsive Field Maps would be with that many values in a dropdown, but my streets with 5100 values works fine.

Also, whatever order the domains are in the update_dict is the order they appear in the dropdown.

R_

RPGIS
by MVP Regular Contributor
MVP Regular Contributor

The other thing to keep in mind also is the risk that you may end up loading far too many values that it could potentially cause editing issues. The issues could likely stem from having too many values that it may overwhelm your editors.

The way we go about it is we simply have set domains for suffixes, prefixes, road types, and street names. By keeping the fields separate with their own unique domain lists keeps the dropdowns smaller and allows for additional updates without needing to update the entire address. This is something else to consider also.

Then, if you wanted to, you could add another field to concatenate all the addressing fields into a single address.

I rarely do anything with python now since finding out how useful arcade and attributes are at keeping the integrity of our data.

If you want to go the python route then @RhettZufelt solution would be the way to go.