AnsweredAssumed Answered

Calculate Field based on Filename

Question asked by clclark on Nov 19, 2012
Latest reply on Nov 19, 2012 by clclark
Ok, this seems simple but I am havnig issues figuring out how to incorporate the filename aspect.

I have a gdb with several Polyline feature classes. In each of these feature classes I have a SPECCODE field. I want to calculate this field based on the file name of the feature class.

EXAMPLE : Feature Classes (STHD, PINK, SOCK, COHO) I would want the SPECCODE field values to be SH, PK, SO, CO respectively for the features classes given.

So I am thinking a script with a If... like:
if featureclass name == STHD than SPECCODE == SH
Else featureclass name == Pink than SPECCODE == PK
Else featureclass name == Sock than SPECCODE == SO


Am I even on the right track here??

Outcomes