Select to view content in your preferred language

Get dataset names

1474
3
06-15-2021 08:22 AM
YinghongLi1
Frequent Contributor

I can get layer name from active map.  Now i need to get database name.  I can get datastore from a basic feature layer object and then get database from the datastore.  I need to get dataset names not table names.

Please help.

thanks

0 Kudos
3 Replies
RichRuh
Esri Regular Contributor

What do you mean by "database name"?  File and mobile geodatabases have a path, feature service geodatabases have a service URL, and enterprise geodatabases have a collection of connection properties.  What is it you are looking for?

--Rich

0 Kudos
YinghongLi1
Frequent Contributor

It is an Oracle SDE database.  Sorry I was not clear.  I will try the code  CarlesMacleod  displayed below and see how it goes.

In our SDE database,  we have many datasets.  I want to be able to list the dataset names and allow user to select ONE dataset and loop through the feature layers in it.

Thank you all!

0 Kudos
CharlesMacleod
Esri Regular Contributor

Rich's question notwithstanding and assuming it is the names of the datasets within a gdb u are after, this snippet might help:

https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#obtaining-list-of-defintions-fro...

 

note the line in question: Call "GetName()" on each definition to get the dataset name.

IReadOnlyList<FeatureDatasetDefinition> featureDatasetDefinitions = 
geodatabase.GetDefinitions<FeatureDatasetDefinition>();

 

0 Kudos