layer.datasetName returns the layer name instead of the dataset name

1342
2
Jump to solution
02-18-2013 07:43 PM
JasonMiller
New Contributor II
Using ArcEditor 10.0 sp5 (Evaluation version)

(See attached picture for code and results...)

When running some python code to get the dataset name for a layer in ArcMap, the layer.datasetName property returns the name of the layer instead of the dataset name.  I don't think the python code gets much simpler, am I just being simple-minded?

[ATTACH=CONFIG]21921[/ATTACH]

JMiller
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Jason,

Your code is returning the correct results.  Take a look at the 'datasetName' property explanation here.

Returns the name of the layer's dataset the way it appears in the workspace, not in the TOC.

The 'name' property differs:

Provides the ability to set or get the name of a layer the way it would appear in the ArcMap table of contents.

So, if you were to change the name of the layer in the table of contents, you can still find the original feature class/shapefile name by using the 'datasetName' property.

View solution in original post

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Jason,

Your code is returning the correct results.  Take a look at the 'datasetName' property explanation here.

Returns the name of the layer's dataset the way it appears in the workspace, not in the TOC.

The 'name' property differs:

Provides the ability to set or get the name of a layer the way it would appear in the ArcMap table of contents.

So, if you were to change the name of the layer in the table of contents, you can still find the original feature class/shapefile name by using the 'datasetName' property.
0 Kudos
JasonMiller
New Contributor II
So in this case the "Dataset Name" is actually referring to the "FeatureClass name", and not the "Feature Dataset" to which it belongs... Thanks ESRI for making that clear as mud... here's an idea, make a property called  layer.featureclassName instead...

Thanks for the response JSkinn3, I had read the info in the link you provided but still had in my mind that "Dataset" was referring to "Feature Dataset"...   A better and more thorough explanation of the terms (as well as how to update the "Feature Dataset" name) can be found here... http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_...
0 Kudos