Is there a way to designate what column is the object ID when creating a standalone table from an oracle database?
When I am creating a standalone table using the StandaloneTableFactory it does not assign a Field as the OBJECT ID type.
using (Geodatabase geodatabase = new Geodatabase(connectionProperties))
using (Table worktable = geodatabase.OpenDataset<Table>(queryTableName))
{
var tableParams = new StandaloneTableCreationParams(worktable)
{
Name = queryTableName,
};
// creates the standalone table.
StandaloneTableFactory.Instance.CreateStandaloneTable(tableParams, MapView.Active.Map);
}
If the standalone table does not have an OBJECT ID it seems to have a tendency to not let the attribute table be viewed once the table is converted to a XY Event Layer.
var uri = standaloneTable.URI;
List<object> arguments = new List<object>
{
// URI of the standalone table to be projected on the map
standaloneTable.URI,
// X Value column
"LON",
// Y Value comlumn
"LAT",
// Where to change the name of the standalone table
tableName,
// Spatial referance 4326 = GCS_WGS_1984 Coordinate system
SpatialReferenceBuilder.CreateSpatialReference(4326),
};
// Takes the standalonetable and makes a XY Event layer
await Geoprocessing.ExecuteToolAsync($"MakeXYEventLayer_management", Geoprocessing.MakeValueArray(arguments.ToArray()));
Now If I got to the database in the catalog view and then just drag the table in to the MapView it creates the standalone table with a column with unique values as the OBJECT ID, thus allowing the XY Event Layer to be created and its attribute layer visible.
Solved! Go to Solution.
It turns out these tables were not being registered with the geodatabase. In case anyone else runs in to this mistake here is the code I used to resolve it.
List<object> arguments = new List<object>
{
// URI of the standalone table to be projected on the map
standaloneTable.URI,
// OBJECTID Value column
"UNIQ_ID",
};
// Takes the standalonetable URI and makes and registers with the geodatabase
var results= await Geoprocessing.ExecuteToolAsync($"RegisterWithGeodatabase_management", Geoprocessing.MakeValueArray(arguments.ToArray()));
I think you should be able to use Geodatabase DDL to modify that table using
schemaBuilder.Modify(modifiedTableDescription);
ProConcepts DDL · Esri/arcgis-pro-sdk Wiki (github.com)
To create an object ID field use this code snippet:
ProSnippets Geodatabase · Esri/arcgis-pro-sdk Wiki (github.com)
Thanks for the suggestion, changing the DDL of the tables not something I am able todo as I have other services that touch these tables as well.
The main issue that I am having that I thought I was due to the tables not having an object ID assigned is when opening the attribute table of a feature layer I am getting and error "Failed to retrieve a page of rows" this seems to happen on a majority of feature layers.
It turns out these tables were not being registered with the geodatabase. In case anyone else runs in to this mistake here is the code I used to resolve it.
List<object> arguments = new List<object>
{
// URI of the standalone table to be projected on the map
standaloneTable.URI,
// OBJECTID Value column
"UNIQ_ID",
};
// Takes the standalonetable URI and makes and registers with the geodatabase
var results= await Geoprocessing.ExecuteToolAsync($"RegisterWithGeodatabase_management", Geoprocessing.MakeValueArray(arguments.ToArray()));