ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / QueryDescription Class / IsObjectIDMappedColumnRequired Method
Version

IsObjectIDMappedColumnRequired Method
Indicates if a virtual ObjectID column is required. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public bool IsObjectIDMappedColumnRequired()

Return Value

true if a virtual ObjectID column is required; otherwise, false (please see remarks).
Exceptions
ExceptionDescription
A database-related exception has occurred.
Remarks

In order for a database table to behave normally, it needs to have an ObjectID column (or a column of some other name) whose type is either FieldType.SmallInteger or FieldType.IntegerAND that the type must be non-nullable. However, there are situations in which such a column does not exist. Consider the example of a query layer-based QueryDescription object whose GetQueryStatement does not include such a column in its selection list. In such a situation, in order for IsObjectIDMappedColumnRequired to be true, one of the following two cases must be true.

1) There is only one non-nullable field whose type is either FieldType.String, FieldType.Date or FieldType.GUID.

2) There are more than one non-nullable fields whose type is either FieldType.SmallInteger, FieldType.Integer, FieldType.String, FieldType.Date or FieldType.GUID.

Furthermore, beware of IsObjectIDMappedColumnRequired returning false. If this method returns false ANDGetObjectIDField returns an empty string, it is most likely the fields on the selection list in GetQueryStatement are either nullable and/or they are not of type FieldType.SmallInteger, FieldType.Integer, FieldType.String, FieldType.Date, or FieldType.GUID. When this situation occurs, calling Database.OpenTable will cause an exception unlessSetObjectIDFields is invoked first with one or more valid fields as arguments.

Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also