There is a good example in the documentation. Adapted for your purposes:
for fc in arcpy.ListFeatureClasses("*","",dataset):
subtypes = arcpy.da.ListSubtypes(fc)
for stcode, stdict in subtypes.iteritems():
for stkey in stdict.iterkeys():
if stkey == 'FieldValues':
You shouldn't need to create a subtype in order to use a coded value domain. It's easy to be fooled by the domain properties dialog as it doesn't have any indicators that the rows in the Domain Properties sections are actually pick lists and it's only the default which is long integer.
I just verified domains without subtypes works (in v10) with:
Subtypes and Domains are for Geodatabases only - exporting to shapefiles will not work (they are old tech compared to geodatabases)
subtypes categorize your data.
domains constrain input information to validate data entry.
Apply coded or ranged domains to features, enabling you to constrain input information to a valid set of values. For example, in a ...
'Export data' does not retain subtypes...use one of the geoprocessing tools like 'Copy Features' or 'Feature Class To Feature Class' -- if you do this within the same ArcGIS process or 'session' as I like to think of it as (such as the current map doc within which you have interactively selected features), then selected features are honored, subtypes are ...
Duplicate your layers to the number of sub-types
In each of the duplicated layers, set a Definition Query to limit that layer to only display one of the sub-type values
And you can now turn on/off sub-types as desired
My guess is the gdb the featureclass lives in does not have any domains defined.
Without any domains in the GDB, the feature class fields doesnt have any to display.
Try creating some in the GDB:
You need to obtain schema lock, i.e you must be the only one connected to the database. Then you change the values in the domain connected to your subtype field.
At least before version 10 using SQL server you couldn't change a value within a domain, only add and delete at the end. To change a value you have to delete from the bottom up to the value you ...
Use the "Remove Domain from Field" tool (Data Management > Domains) to remove the attribute rule, allowing you to delete the domain.
If you want to export a domain to a shapefile, you have to go through a six step process.
Export the feature class to shapefile.Add a new field
of the appropriate type to the shapefile (e.g. String if the
The arcpy.da.ListSubtypes() function returns a dictionary.
The keys of the dictionary are the subtype codes, and the values of
the dictionary are the subtype properties.
subtypes = arcpy.da.ListSubtypes(r'C:\temp\data.gdb\Water\Fittings')
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
The Remove Subtype GP tool can accept a list ...
If you happen to have access to Esri's Production Mapping Extension (what used to be called PLTS), they have a Add Subtypes button that will do exactly this. Here is the help page for this particular tool:
Adding subtypes as layers
I had the same issue a while back when I transitioned into an Enterprise Level GDB.
The workaround is a bit convoluted but it gets what you need:
From your Geodatabase:
Enter Domain Name (use the FeatureClass name)
Set Domain Properties (field type, domain type, etc)
Enter Code (this is what will populate in ...
If you use a database backend that supports domains, such as Postgresql, you can set a domain on a field. However, QGIS doesn't recognize domains yet so as you create or edit features you can try to put anything into that field, there is no dropbox like in ESRI's products. If the values violate the constraint of the domain you'll get an error when you try ...
This will only apply to ArcGIS for Desktop 10.1 and later but at those versions the Assign Domain To Field (Data Management) tool
is available and ...
Sets the domain for a particular field and, optionally, for a subtype.
If no subtype is specified, the domain is only assigned to the
To obtain an iterable list of subtypes for a ...
I'd recommend checking out the X-Ray for ArcCatalog extension created by ESRI.
X-Ray for ArcCatalog extension for 10.1
X-Ray for ArcCatalog extension for 10.2 - 10.3
Here's a snip from the description:
The X-Ray for ArcCatalog add-in can be used to develop, refine and document your geodatabase designs. This version can be used natively in ArcCatalog and ...
It may be worth your while taking a look at Survey123 for ArcGIS. This is an Esri app that allows you to use conditional logic while collecting data. At the moment it can only be used to collect points (no lines or polygons) so this may rule it out straight away. It is form centric, not map centric and can only be used to collect data - i.e. you cannot edit ...
The problem is in the fact that what you wrote is different from what you think you wrote. The comment says "retrieve the first item", but what really happens is "build a list that consists of the first item of every entry in the big list".
bigFC = [itemA for itemA in bigNeighborList] #retrieve the first item
subtype = [itemA for itemA in ...
To get dropdowns and default values for new features, try creating a feature template for each subtype.
In ArcMap, right click the current template in the Create Features window, and select copy. Then adjust the values accordingly.
Or in ArcGIS Online, after opening the add new features panel, hit Manage at the bottom right of the panel, then hit Add new ...
The answer is no you cannot have multiple subtype fields on a single feature class. You are only able to select one field as the subtype field in the Feature Class properties.
There are some suggestions on the ArcGIS Ideas site asking for subtypes to be made available on multiple field, like this one - Allow subtypes on multiple fields
The way that I would try to do this would be to switch the feature class under the layer that you clipped by setting lyr.dataSource to your clipped feature class.
The asker used this answer to resolve this. See updated code below for their final working solution. Note the layer name of the original is "Feature" in this example:
workspace = arcpy.env....
Tested that pasting does not respect the subtypes on 10.5.1. Tested on 10.3.1 and the results are the same; the values are being inserted into a default subtype. I've reported this to the Tech Support; there is a bug registered BUG-000111885: Pasting the features between the feature classes does not respect subtype. Your only option is to use the GP tool. ...
It looks like you are misusing the subtype feature. It has been designed to be able to set various attributes on features to streamline creating new features. You are not creating any new country, so you would be better off with a geodatabase domain.
Unless you have a workflow where you have to use the subtypes and you need to keep them sorted, you would ...
The Field Calculator will work on fields with Domains and Subtypes. You need to enter the coded value into your field calculator rather than the Domain Description, but other than that it'll work the same way it does for any other field.
If you have a domain like:
1 | Monday
2 | Wednesday
3 | Friday
and want to populate your selected records with ...
Here is my workaround solution;
I modified a standalone Python script i found in ArcGIS 10.4.1 help (Tool Help for the Add Subtype tool)
I can easily change and modify the list of subtypes in the script, then run it and it removes the existing subtypes sets up new subtypes and sets the default.
# Name: ManageSubtypes.py
# Purpose: Create a subtype ...
It sounds to me as though there are a couple points of confusion...
The default value for a given field is set under the feature class properties, on the "Fields" tab, not Subtypes:
Select the field in the upper box
Look at the lower box which indicates what the Default Value is and also what geodatabase domain is associated with the field
If you cannot ...
Technically yes, but it kind of depends on your situation and existing data. What you're talking about are Feature Templates, also discussed at this blog post. However the templates may not display as you set them if there are already features symbolized in the map.
If you do have existing data symbolized in the map, you don't have to create a layer file ...
You should be able to create an empty Personal Geodatabase (*.mdb; an Access database) and then copy/paste feature classes from a File Geodatabase (*.gdb) into it.
There will be limits to what you can see in it using MS Access.
You will also need to click on the field in the feature class properties in order to see the properties of that field and choose whether to use a domain.
If no domains are seen, check that data type of domain and field you wish to use it with match.