Split by Attributes in 10.5 is only outputting tables - not shapefiles

3977
13
Jump to solution
11-01-2017 11:51 AM
WillMcInnes
New Contributor III

I am using the new Split by Attributes tool in 10.5. When I put in a shapefile as input, the outputs are tables only, no shapefiles. It reports in the tool output that shapefiles are being created, but only .dbf files are available in the output workspace.

Any ideas are appreciated.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

try moving the file into a geodatabase... it could be the way it treats shapefiles.  There is nothing obvious with your code that would make if select the dbase portion.

However... why don't you throw the 'Shape' field into the end of the mix... I am sure it will just return everything... but it will confirm whether dbase of features are returned

Also reverse the order to check

Other than that, examine my code to pull out the portions you need

View solution in original post

13 Replies
DanPatterson_Retired
MVP Emeritus

perhaps you ran it from a table view, rather than selecting the layer in the table of contents, then ensuring you are selecting the layer by name in the tool dialog... if that doesn't work try the old-school Split Layer by attributes since you are working with shapefiles

WillMcInnes
New Contributor III

Hi Dan, I have done a bit more testing. I can run it successfully from ArcMap, but from ArcPy it still only creates tables. Are they different tools on the back end? Any other ideas?

0 Kudos
DanPatterson_Retired
MVP Emeritus

I suspect you are grabbing the table in your script rather than the featureclass.

There is nothing in Split Attributes that has an extra 'toggle'.   Your code might reveal whether it is just the table or the featureclass

0 Kudos
WillMcInnes
New Contributor III

Thanks Dan, here is the snippet of where I am splitting by attributes. Is there something obvious I am missing below that is selecting the table and not the feature?

import arcpy
import sys
import os
from arcpy import env

#Working folder
wFold = 'C:/Users/Will/Desktop/Testing'

#name of input points
inPts = "ARMs_UTM.shp"

#name of field with unique point names (e.g. ARMsID)
spltFld = "ARMs_numbe"

#Output features folder
ptLoc = 'C:/Users/Will/Desktop/Testing/pts'

#Set workspace
arcpy.env.workspace = wFold 

arcpy.SplitByAttributes_analysis (inPts, ptLoc, spltFld)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
DanPatterson_Retired
MVP Emeritus

try moving the file into a geodatabase... it could be the way it treats shapefiles.  There is nothing obvious with your code that would make if select the dbase portion.

However... why don't you throw the 'Shape' field into the end of the mix... I am sure it will just return everything... but it will confirm whether dbase of features are returned

Also reverse the order to check

Other than that, examine my code to pull out the portions you need

WillMcInnes
New Contributor III

Great! The answer was to move it into a gdb, thanks for all your help.

Will

AliciaShyu
Occasional Contributor

Thanks, Dan for your valuable input. I just wanted to clarify your answer a little bit, since I had problems understanding it until my native English speaking coworker explained it to me.
Moving the input file into a geodatabase as a feature class will solve the problem of the output being a dbf file instead of shapefile when the output location is a folder.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Alicia, if the input is a featureclass, the output is a featureclass which could be a shapefile if you are using a folder as a destination rather than a geodatabase.

If the input is a table, the output is a table.  following the same logic, if the output location is a folder, then a *.dbf will be output.  If a geodatabase is the destination, then a gdb table will be output.

Mind you, I can't test since I haven't used ArcMap in quite some time

0 Kudos
WillMcInnes
New Contributor III

Thanks Dan, I was tried running it a few ways, including from ArcPy, and I got the same result. It is definitely the right layer, but it is outputting the features as dbf tables only. 


I did some more experimenting, and I think the issue stems from the split field being numerical (long). I created a new column and put a letter at the beginning of each number, and it seemed to work just fine. For now I will add the step of adding some string text at the beginning of each id as a workaround.