After you publish a hosted feature or table layer, you may find you need to store information about an additional attribute. When that happens, you can add a field to the layer. Similarly, if you discover a set of attributes is no longer needed, you can delete the field that stores those attributes from the layer.
Only the layer owner or an administrator can add a field to a hosted feature layer or delete a field from a hosted feature layer.
Add a field
When you open the details page for a hosted feature layer, you can use the Table or Fields view on the Data tab to add a field.
Add fields from the Table view
Follow these steps to add a field to an attribute table from the Table view:
- From the layer's item page, click the Data tab to show the table.
Note:
You can also perform these steps from the table in Map Viewer.
- If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
- Click the Options button .
- Click Add Field and set the following:
- Field Name—Field names should not contain special characters, such as spaces, hyphens, parentheses, brackets, or characters such as $, %, and #. Avoid using field names that contain words that are typically considered database-reserved keywords, such as CHARACTER or DATE. If you attempt to add a field name with special characters or a database-reserved keyword, you'll receive an error message.
- Display Name—An alternative name or alias for a field that is more descriptive and user-friendly than the name. The alias can contain special characters and database-reserved keywords.
- Type—Choose one of the following for the type of data you will store in the field:
- Date—Date and time. See Work with date fields.
Note:
While your portal stores all date values in UTC, you'll typically view and edit dates in your local time zone because most applications automatically convert to and from UTC. You will, however, need to specify the appropriate time zone when uploading your data—for example, as CSV files or shapefiles—otherwise, your data is assumed to be in UTC.
- Double—Numbers with decimal places.
- Integer—Whole numbers from -2,147,483,648 to 2,147,483,647 (long integer).
- String—Any sequence of characters.
- Length—This property is only available for string fields. Length is the maximum length, in single-byte characters, that a string field can store. Length is required for the String field type. The default is 256 characters.
- Date—Date and time. See Work with date fields.
- You can define a default value that will be added to the field for all new features. Any existing rows in the table will not have this default value when the field is added.
- If the hosted feature layer does not contain data, you can uncheck Allow Null Values if you want to be sure editors always supply a value for the new field when adding features or updating attributes.
This option is not available if the layer contains data, and the new field will allow null values.
- Click Add New Field.
Add fields from the Fields view
Follow these steps to add a field to an attribute table using the Fields view:
- From the layer's item page, click the Data tab to show the table.
- Click Fields.
- If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
- Click Add and set the following:
- Field Name—Field names should not contain special characters, such as spaces, hyphens, parentheses, brackets, or characters such as $, %, and #. Avoid using field names that contain words that are typically considered database-reserved keywords, such as CHARACTER or DATE. If you attempt to add a field name with special characters or a database-reserved keyword, you'll receive an error message.
- Display Name—An alternative name or alias for a field that is more descriptive and user-friendly than the name. The alias can contain special characters and database-reserved keywords.
- Type—Choose one of the following for the type of data you will store in the field:
- Date—Date and time. See Work with date fields.
Note:
While your portal stores all date values in UTC, you'll typically view and edit dates in your local time zone because most applications automatically convert to and from UTC. You will, however, need to specify the appropriate time zone when uploading your data—for example, as CSV files or shapefiles—otherwise, your data is assumed to be in UTC.
- Double—Numbers with decimal places.
- Integer—Whole numbers from -2,147,483,648 to 2,147,483,647 (long integer).
- String—Any sequence of characters.
- Length—This property is only available for string fields. Length is the maximum length, in single-byte characters, that a string field can store. Length is required for the String field type. The default is 256 characters.
- Date—Date and time. See Work with date fields.
- You can define a default value that will be added to the field for all new features. Any existing rows in the table will not have this default value when the field is added.
- If the hosted feature layer does not contain data, you can uncheck Allow Null Values if you want to be sure editors always supply a value for the new field when adding features or updating attributes.
This option is not available if the layer contains data, and the new field will allow null values.
- Click Add New Field.
Delete a field
Exercise caution when deleting fields as, once you delete a field, the data within the field cannot be restored. Also, maps that use the field for filters or to apply styles will lose the filter or styling when you delete the field from the layer.
You cannot delete system fields such as the OBJECTID, CREATIONDATE, CREATOR, EDITDATE, and EDITOR fields or fields used for styling, the time slider, filter, labels, search, or editor tracking. However, be aware that maps may be using fields for styling and filters that are different than the fields you configured on the layer, and the Delete option is available for these fields. Exercise caution when deleting fields that may be used for styling and filtering in maps.
When you open the details page for a hosted feature layer, you can delete a field from the Table or Fields view on the Data tab.
Delete a field from the Table view
Follow these steps to delete a field from an attribute table using the Table view:
- From the layer's item page, click the Data tab to show the table.
Note:
You can also perform these steps from the table in Map Viewer.
- If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
- Click the column containing the field you want to delete.
- Click Delete. Confirm that you want the field deleted.
Delete a field from the Fields view
Follow these steps to delete a field from an attribute table using the Fields view:
- From the layer's item page, click the Data tab to show the table.
- If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
- Click the check box next to the field you want to delete.
- Click Delete. Confirm that you want the field deleted.
If the Delete button is not present, one or more of the selected fields cannot be deleted.
Restrictions when adding or deleting fields
Consider the following when adding or deleting fields:
- You cannot add fields to or delete fields from copies of hosted feature layers, hosted feature layers that have related tile layers, or views created from hosted feature layers.
- When you add a field to a hosted feature layer that has dependent hosted feature layer views, you must update the definition of each view in which you want the new fields to appear.