How to search for a FC in ArcCatalog that is located in a FS

584
6
04-08-2019 06:27 AM
JoseSanchez
Occasional Contributor III

Hello everyone,

Using ArcCatalog, how can I search for a FC that is located in a FD, but I do not know the FD where it is located.

Thanks

0 Kudos
6 Replies
JoshuaBixby
MVP Esteemed Contributor

Are you looking a GUI option or some Python code to run in the interactive Python window?

0 Kudos
JoeBorgione
MVP Emeritus

+1 for Joshua Bixby‌'s comment

Your title indicates Feature Service (FS) but the body of your post indicates Feature dataset (FD).  

That should just about do it....
0 Kudos
DanPatterson_Retired
MVP Emeritus

Walk? Walk—Data Access module | ArcGIS Desktop 

Find the featureclass, hence the featuredataset.  Of course limiting the start point would be the key

As for FS? FD? which

Asrujit_SenGupta
MVP Regular Contributor

If the Database Connection is indexed, you can directly search in the Desktop interface.

Using search in ArcGIS—Help | ArcGIS Desktop 

JoseSanchez
Occasional Contributor III

Good morning,

Sorry I mean Feature Dataset. We have an SDE database with more than 1000 Feature classes and tables. most of the FC are inside Feature Datasets.. So when we get a call for an user asking for the location of a FC it will be very helpfull to have a tool to search for a FC.

0 Kudos
leomonterol
Esri Contributor

Hi Jose

You can use the script below in ArcCatalog's python window (Change fcName and pathToSDEConnectionFile)

# Feature Class Name (E.g. TestDB.DBO.TestPolygonFeatureClass)
fcName = 'TestGDB.DBO.TestPolygonFeatureClass'

# Path to the sde connection file 
pathToSDEConnectionFile = r'C:\tmp\sdeConnections\localhost.sde'

arcpy.env.workspace = pathToSDEConnectionFile

datasets = arcpy.ListDatasets(feature_type='feature')
datasets = [''] + datasets if datasets is not None else []

for ds in datasets:
	for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
		if ( fc.upper() == fcName.upper()):
			print('Feature Class ' + fc + ' found in ' + ds + ' Dataset')‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Regards,

Leo