rkallstrom

Getting the input file name

Discussion created by rkallstrom on Nov 14, 2011
Latest reply on Nov 15, 2011 by rkallstrom
Hi folks-

I need help thinking something through. Basically what I'd like is to have a modified append tool that not only appends multiple the point attribute data, but also "pastes" the inputted shapefile's name(s) to a filename attribute column.  That way I can track where the data came from.  The only way I can think to do this is something along the lines of the following:

for each shp in featureclasses:
  outFeatureClass = os.path.join("C:\GIS\Scripts\temp\temptrks", shp.strip(".shp"))
  arcpy.CopyFeatures_management(shp, outFeatureClass)
  arcpy.AddField_management(outFeatureClass, "filename", "TEXT", "","", "254")
  arcpy.CalculateField_management(outFeatureClass, "filename", 
                                str(shp), "PYTHON")


Then I'd like to append it to a target dataset.

What I'd like to do is be able to have a user drag and drop multiple shapefiles from multiple directories into a Multiple Value input box (like that in the Append tool).

My questions are two:
1) Is there an easier/better way?
2) If not, to what do I set the parameter type (Multiple Value is not a selection).

RK

Outcomes