HOW TO

Limit the size of file attachments in a feature class in ArcGIS Pro

Last Published: July 19, 2024

Summary

In ArcGIS Pro, file attachments, such as documents and images, can be added to feature classes. They are stored in a geodatabase feature class attachment table and linked to individual features. Refer to ArcGIS Pro: Add or remove file attachments for more information.

This article provides the workflow to limit the size of file attachments in a feature class in ArcGIS Pro. This method is useful when limiting the size of attachments, for example images, for newly created features on a map.

Procedure

  1. Open the ArcGIS Pro project.
  2. Enable attachments for the feature class.
  3. In the Catalog pane, expand Databases and the feature class geodatabase.
  4. Right-click the feature class attachment table and click Data Design > Attribute Rules to open the Attribute Rules view.
  5. Add a constraint rule to the attachment table.
    1. In the Attribute Rules view, on the Constraint tab, click Add Rule.
    2. In the details pane of the rule, specify a name for Rule Name.
    3. Specify a description of the rule for Description.
    4. Click the Expression The Expression icon icon to open the Expression Builder window.
Adding a constraint rule in the Attribute Rules view
  1. In the Expression Builder window, in the expression box, type the following expression. Replace <dataSizeField> with the name of the data size field in the attachment table, and replace <dataSize> with the maximum size of data (in bytes) for attachments in the feature layer.
if ($feature.<dataSizeField> > <dataSize>) return false;
return true;
The code block below shows the full working expression.
if ($feature.DATA_SIZE > 2000000) return false;
return true;
Note:
The units of the data size field in the attachment table is in bytes. For example, a value of 2,000,000 is equal to 2MB.
  1. Click the Verify The Verify icon icon to verify the expression, and click OK.
  2. In the details pane of the rule, specify a number for Error Number, and specify a message for Error Message.
  3. Check the Insert check box under Triggers.
Configuring the parameters of the new constraint rule Building the expression for the constraint rule
  1. On the top ribbon, click Save.

The image below shows an error message returned when adding an attachment to a feature if the file size is larger than the limit specified in the constraint rule.

An error is returned when attempting to attach a file larger than the limit specified in the constraint rule

Article ID: 000031269

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 3
  • ArcGIS Pro 3 2

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options