3

I am analyzing a database in ArcMap 10.1 and I wanted to know whether it is possible to trace what tables are linked to a particular Coded Value Domain? I am attempting to find a particular table.

I know that you can do this the other way around and look at what Coded Value Domains are being assigned to a table but as the database is soo large this isn't particularly useful.

Any suggestions would be helpful, thanks for your time.

5

Yes, you can do this with arcpy. I usually use arcpy.da.ListDomains to iterate through the domains but in your case you just need to see if there are any domains assigned to a field in feature classes. This code can iterate really quickly through multiple feature classes and report those that have a field that has been assigned to the domain you've specified.

import arcpy    
gdb = r"C:\GIS\SDE_DB_CURRENT_SNAPSHOT.gdb" #supply the geodatabase path
arcpy.env.workspace = gdb
domain_to_search = r"CodedValuesCountries" #supply the CV domain name

fcs_list = arcpy.ListFeatureClasses()
for fc in fcs_list:
    #print fc
    fc_fields = arcpy.ListFields(fc)
    for field in fc_fields:
        #print field.domain
        if field.domain == domain_to_search:
            print "feature class that uses this domain is", fc

This code can be run from Python window in ArcGIS, as a script tool or from an IDLE or IDE such as PyScripter.

  • I'm sorry I am quite new to Python, could you please highlight the sections/text that I would need to modify for my own purposes? Thanks. – Canningmister May 30 '14 at 11:05
  • @Canningmister, I've edited the code with comments. Let us know if you've managed to run it and works for you. – Alex Tereshenkov May 30 '14 at 11:17
  • I believe this works, however it's not showing any results so maybe I haven't got the file path for the database correct? – Canningmister May 30 '14 at 14:28
  • Could be. Update your question with all relevant details then please. – Alex Tereshenkov May 30 '14 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.