I want to use summary statistics to dissolve duplicates in my table (no geometry) before performing a spatial join. The code works just fine and creates my output table in ArcMap but when I try to use it in my script I get an error that "GBAper1" does not exist. I have tried everything on my mind but can't find the problem.
What don't I see ?
arcpy.Statistics_analysis(BldAreaPivot2, GBAper1, "afdak SUM;
ingezonken SUM;loopbrug SUM;trap SUM;verdieping
SUM;verheven SUM;zichtbare SUM", "CKEY")
fields=arcpy.ListFields('GBAper1')
for field in fields:
print field.Object.name
When I write the same lines of code as specified in the tool help, I get a syntax error but the code above works as I get my outputs directly in Arcmap.
GBAper1 = folderFoot + case + "_perGba1"
arcpy.Statistics_analysis(BldAreaPivot2, GBAper1, [["afdak", "SUM"],
["ingezonken", "SUM"], ["loopbrug", "SUM"], ["trap", "SUM"],
["verdieping", "SUM"],["verheven", "SUM"], ["zichtbare", "SUM"]]", "CKEY")
fields=arcpy.ListFields('GBAper1')
for fieldObject in fields:
print field.Object.name
Changing 'GBAper1' works for Listing the fields. I get the fields (OBJECTID,CKEY,FREQUENCY, SUM_afdak,SUM_ingezonken,SUM_loopbrug, SUM_trap, SUM_verdieping, SUM_verheven, SUM_zichtbare). So GBAper1 exists and has a field "CKEY". But when I try to join it to a shapefile I get the message:
"ERROR 000728: Field CKEY does not exist within table Failed to execute (AddJoin)"