Add or delete a field

After you publish a hosted feature or table layer, you may need to store information about an additional attribute. When that happens, you can add a field to the layer. Similarly, if you discover that 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:

  1. From the layer's item page, click the Data tab to show the table.
    Note:

    You can also open the table in Map Viewer (which was formerly a separate beta installation but is now included in the portal by default) or open the table in Map Viewer Classic (formerly known as Map Viewer) to add fields to a table.

  2. If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
  3. Click the Options button Options.
  4. Click Add Field and set the following:
    1. Field Name—Field names cannot 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.
    2. 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.
    3. 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.

        If you add a string field, use the Length property to define the field's maximum single-byte character length. Length is required for the String field type. The default is 256 characters.

    4. 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.
  5. If the hosted feature layer does not contain data, you can uncheck Allow Null Values if you want to ensure 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.

  6. 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:

  1. From the layer's item page, click the Data tab to show the table.
  2. Click Fields.
  3. If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
  4. Click Add and set the following:
    1. Field Name—Field names cannot 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.
    2. 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.
    3. 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.

    4. 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.
  5. If the hosted feature layer does not contain data, you can uncheck Allow Null Values if you want to ensure 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.

  6. Click Add New Field.

Delete a field

Exercise caution when deleting fields, because 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:

  1. From the layer's item page, click the Data tab to show the table.
    Note:

    You can also open the table in Map Viewer (which was formerly a separate beta installation but is now included in the portal by default) or open the table in Map Viewer Classic (formerly known as Map Viewer) to delete fields from a table.

  2. If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
  3. Click the column containing the field you want to delete.
  4. 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:

  1. From the layer's item page, click the Data tab to show the table.
  2. If your hosted feature layer contains more than one sublayer, choose the sublayer you want to alter from the Layer drop-down menu.
  3. Check the check box next to the field you want to delete.
  4. 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.
  • You cannot add fields to or delete fields from hosted feature layers that are used to generate views as a result of running the Join Features tool.
  • 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.