ArcGIS Pro 2.8 API Reference Guide
IsObjectIDMappedColumnRequired Method

ArcGIS.Core.Data Namespace > QueryDescription Class : 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()
Public Function IsObjectIDMappedColumnRequired() As Boolean

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.Integer AND 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 AND GetObjectIDColumnName 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 unless SetObjectIDFields is invoked first with one or more valid fields as arguments.

Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

QueryDescription Class
QueryDescription Members