i'm trying to use the suggestion in this post from @RandyBurton
to merge 25 or so shp files and map the fields but using the code i get a strange output
any suggestions?
Stu
Hi @StuartMoore. Could you please include the code snippet you're running? Are you working in ArcMap or ArcGIS Pro?
fields = [
['LINENAME "LINENAME" true true false 100 Text 0 0,First,#,{0};', '{0},LINENAME,0,50'],
['LAUNCH "LAUNCH" true true false 100 Text 0 0,First,#,{0};', '{0},LAUNCH,0,50'],
['RECEIVER "RECEIVER" true true false 100 Text 0 0,First,#,{0};', '{0},RECEIVER,0,50'],
['PROJNO "PROJNO" true true false 100 Text 0 0,First,#,{0};', '{0},PROJNO,0,50'],
['INSPTYPE "INSPTYPE" true true false 100 Text 0 0,First,#,{0};', '{0},INSPTYPE,0,50'],
['INSPDATE "INSPDATE" true true false 100 Text 0 0,First,#,{0};', '{0},INSPDATE,0,50'],
]
fmap = ''
for fld in fields:
fm = []
for fc in r_plin:
fm.append(fld[1].format(fc))
fmap = fmap + fld[0].format(','.join(fm))
messages.addMessage(fmap)
#messages.addMessage(fieldMappings)
arcpy.Merge_management(inputs= r_plin,output="C:/tmp.gdb/tmp_Polyline2",field_mappings= fmap)
hi @BlakeTerhune above is the code i'm using, i forgot to say i'm using it in an python toolbox in arc catalog
thanks
Stu
@StuartMoore wrote:i'm using it in an python toolbox in arc catalog
What are the parameters in the toolbox?
the only parameters are in input folder which contains the shp files and an output folder for where the merged gdb is placed
Stu
i've been trying a few other ways like mergeing 5 files at a time but i now get this error
i've even increased the field lengths and set the field map lengths to only use the first 50 characters (from my basic understanding)