To improve data quality, you can provide editors a list or range of acceptable values for fields in hosted feature layers. For example, say a hosted feature layer stores information about city-owned trash containers placed throughout the city. Your city uses plastic and aluminum bins with capacities from 15 to 50 gallons. To prevent editors from typing incorrect values and avoid typos, you can create a pick-list for the material field that includes the two values—plastic and aluminum—and set a minimum value of 15 and maximum value of 50 for the bin's capacity field.
As the owner of a hosted feature layer or a member of the default administrator role, you can create a list of acceptable attribute values for text, numeric (integer, small integer, and double), and datetime (date, date only, and time only) fields. You can also define the possible minimum and maximum values for numeric and datetime (date, date only, and time only) fields.
Create a domain list
When you define a list of values, you set a code—the value stored in ArcGIS Online—and a label—the value presented to users in the values list and attribute table when they access it in ArcGIS Online.
To define the list, you have the following options:
- Type the code and label values.
- Let ArcGIS Online query the field to populate the list with all existing unique values.
The list of codes and labels will be the same. You can provide a different label value for each of the codes. You can also add label and code value pairs to the list.
- Import label and code values from a comma-separated values (CSV) file.
Name the columns Label and Code, respectively. If the file does not contain columns with those names, the first two columns in the file will be used. All other fields in the file are ignored.
Because this is a comma-separated values file, numeric values that contain a comma will be read as separate values. Do not include commas in numeric values. For example, a code for a numeric field can be 1000000, but not 1,000,000; the latter will be read as three separate values: 1, 000, and 000.
For string field types, the code values in the .csv file must be shorter than the maximum length defined for the field.
Field values for date and time values in the .csv file must be formatted as follows:
Field data type Supported format Date YYYY/MM/DD hh:mm:ss or YYYY-MM-DD hh:mm:ss
If milliseconds are present, they will be dropped.
Date Only YYYY-MM-DD Time Only 24-hour time in the format hh:mm:ss
Note:
Date field data types are stored in coordinated universal time (UTC) but displayed in the local time used by your browser. See Storage of date values for hosted feature layers and How date fields are displayed for more information.
Creating a list of values that editors can use to populate the field is useful if you have a limited number of possible values.
Follow these steps to create a list of valid values for a field in a hosted feature layer:
- Open the hosted feature layer's item page, and click the Data tab to open the attribute table.
- Click the Fields button
.
- If the hosted feature layer contains more than one sublayer, use the Layer drop-down menu to choose the sublayer that contains the field you need.
- Click the field's display name to open settings for the field.
- Scroll to the Domain section and click Get started.
- Choose List and click Next.
- Choose one of the following to define the domain list:
- Enter values—Provide all labels and corresponding codes.
- Find values—Existing unique values stored in the field are presented to you as both the label and the code. Alter the labels as needed.
Note:
Only the first 2,000 unique values in the table appear when you use the Find values option.
- Import values—Provide a .csv file that contains the labels and codes.
- Click Next.
- For each additional label and code pair that you need, do one of the following:
- To add a new pair to the end of the list, click Add value and type another label and its corresponding code.
Click Add value to add a label and code pair to the end of the list. - To insert a new pair before an existing pair, check the box next to the label and code pair, click the Options button
next to it, click Add above, and populate the new label and code.
Choose Add above from the Options menu to insert a row above the selected row. - To insert a new pair after an existing pair, check the box next to the label and code pair, click the Options button
next to it, click Add below, and populate the new label and code.
Choose Add below from the Options menu to insert a row below the selected row.
- To add a new pair to the end of the list, click Add value and type another label and its corresponding code.
- To change the order, drag the label and code pair up or down in the list.
- To delete one label and code pair, click the Options button
next to the label and code pair and click Delete.
Choose Delete from the Options menu to delete the selected row. - To delete multiple label and code pairs, check the box next to every pair you want to delete and click Delete selected at the top of the Manage domain window.
To select all label and code pairs, check the box next to Label (displayed value).
- When you finish defining the list of suggested values for a field, click Save.
If the list contains errors—for example, the .csv file you imported had an empty label or code, contained duplicate labels or codes, or defined a code that exceeds the maximum length or precision for the field—a message is returned indicating that there are errors and the domain will not save.
To identify and correct errors in the domain list, enable the Show errors toggle button. When all errors are corrected, click Save again.
The list of values is available for editors to use.
If the field allows null values, the list of values presented to the users will contain a -No value- option in addition to the values you define.
Edit a domain list
You can change the contents and appearance of an existing list of values. For example, you may find you have more aluminum than plastic bins in the city and you want that to be the first value editors see in the list. Or you may find that additional values are needed. For example, if your list of trash bins needs to allow for steel bins, you can edit the list to add this new value.
You can also change existing label values in the list. When you do, users see the new label when they view the list of values and the attribute table in ArcGIS Online.
Caution:
You can change existing code values, but this is not recommended if there is data in the field that is using the code. When you change a code value, existing attribute values are not updated in the table. You can also delete a value from the list, but existing values in the attribute table will appear with the code rather than the label. For example, if you delete the plastic,PL value, people will see PL when they view the attribute table in ArcGIS Online.
Follow these steps to edit a list of valid values for a field in a hosted feature layer:
- Open the hosted feature layer's item page, and click the Data tab to open the attribute table.
- Click the Fields button
.
- If the hosted feature layer contains more than one sublayer, use the Layer drop-down menu to choose the sublayer that contains the field you need.
- Click the field's display name to open settings for the field.
- Scroll to the Domain section and click Edit.
- Optionally, type label or code names in the Search field to find the domain to edit.
- Optionally, perform any of the following edits:
- Drag a label and code pair to a new location to reorder the list.
- Click Find values to add to the domain list any unique values in the layer that are not presently included in the domain.
- Click Add value and type a new label and code to add it at the end of the list.
- To insert a new label and code pair before an existing pair, check the box next to the label and code pair, click the Options button
next to it, click Add above, and populate the new label and code.
Choose Add above from the Options menu to insert a row above the selected row. - To insert a new pair after an existing pair, check the box next to the label and code pair, click the Options button
next to it, click Add below, and populate the new label and code.
Choose Add below from the Options menu to insert a row below the selected row. - To change a label or code value, type a new value in the appropriate field.
- To delete one label and code pair, click the Options button
next to the label and code pair and click Delete.
Choose Delete from the Options menu to delete the selected row. - To delete multiple label and code pairs, check the box next to every pair you want to delete and click Delete selected at the top of the Manage domain window.
Tip:
To select all label and code pairs, check the box next to Label (displayed value).
- When you finish editing the list of suggested values for a field, click Save.
Delete a list of values
If it no longer makes sense to restrict the values editors provide when adding or updating an attribute value—for example, if the list of bin material becomes so long that it would not be usable when editors are updating information in the field—you can delete the list of values. Editors will no longer be presented with a value list when performing future edits.
Caution:
Existing values in the attribute table remain in the table but will appear with the code rather than the label. For example, if you delete the list of values from the material field, people will see PL and AL when they view the attribute table in ArcGIS Online.
Follow these steps to delete a list of values:
- Open the hosted feature layer's item page, and click the Data tab to open the attribute table.
- Click the Fields button
.
- If the hosted feature layer contains more than one sublayer, use the Layer drop-down menu to choose the sublayer that contains the field you need.
- Click the field's display name to open settings for the field.
- Scroll to the Domain section and click Edit.
- Click Delete list at the bottom of the Manage domain window.
- Click Delete list to confirm that you want to delete the list of values.
Domain lists are not sent to the recycle bin; they are immediately deleted.
Set minimum and maximum values
You can define a range of valid minimum and maximum values for a small integer, integer, double, date, date only, or time only field. When editors add or update a value for the field, they receive a warning if the value they type is outside the range. If they continue with the edit, the field reverts to the previous value.
Follow these steps to set a minimum and maximum value range for a field:
- Open the hosted feature layer's item page, and click the Data tab to open the attribute table.
- Click the Fields button
.
- If the hosted feature layer contains more than one sublayer, use the Layer drop-down menu to choose the sublayer that contains the field you need.
- Click the field's display name to open settings for the field.
- Scroll to the Domain section and click Get started.
- Choose Range and click Next.
- Provide the lowest value allowed in the Minimum value field.
- Provide the highest value allowed in the Maximum value field.
- When you finish defining the range of values for a field, click Save.
You can increase or decrease the range of valid values for a field. If you decrease the range, existing values in the field that fall outside the new range will remain in the table. If those values are no longer valid, you must manually edit them.
Considerations when setting or editing domain lists or ranges
Keep the following in mind when working with lists of values or ranges:
- For numeric and datetime fields, you can define a list or a range but not both. Once you define one, you cannot configure the other.
- You cannot configure a list or set minimum and maximum values for system fields such as shape_area, shape_length, FID, and ObjectID.
- In ArcGIS Online, you can configure domain lists and ranges for hosted feature layers only; you cannot configure domain lists or ranges for hosted feature layer views or ArcGIS Server feature layers. If you create a hosted feature layer view from a hosted feature layer, the list or range domain is applied to the layers in the view but cannot be altered from the view. To apply list or range domains to ArcGIS Server feature layers, you must define domains on the data in the geodatabase before you publish the feature layer. See Create and manage domains in the ArcGIS Pro help for more information.
- When you publish a hosted feature layer from data in ArcGIS Pro or ArcMap that has coded value domains, those domains appear as a list domain in ArcGIS Online. However, lists in ArcGIS Online apply to and can be modified for individual fields only; altering the list on one field does not change the domain values on other fields.
- For ArcGIS Server feature layers, you can view coded value domains and range domains on fields as lists and minimum and maximum values, respectively, but you cannot edit them in ArcGIS Online.
- If you publish a hosted feature layer from ArcGIS Pro or ArcMap that contains subtypes with associated domains on other fields, you cannot view or edit the domains in ArcGIS Online.
- If you create a list for a field to which you have applied the Types (Unique Symbols) style, ensure the values in the list are the same as the unique values defined for associated editing templates.