arcpy maketableview

2266
3
Jump to solution
09-24-2014 11:25 AM
JeffGodfrey
New Contributor II

How do I hide certain fields when I make a table view, so when I export the table I only get the fields I need?

I have the following code in python:

arcpy.MakeFeatureLayer_management(sde_CHELAN_Property_Polygons, CHELAN_Property_Polygons_Lay, "", "", "OBJECTID OBJECTID HIDDEN NONE;PLAT_NO PLAT_NO HIDDEN NONE;SP_ID SP_ID HIDDEN NONE;......

 

I have also attached the complete python script.

 

 

When I export my table to excel I still get all the fields. 

 

Thank you

Jeff Godfrey

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Jeff,

The Make Feature Layer and Make Table View tools only hide the fields, they don't actually delete them.  What I would recommend doing is adding the 'Table to Table' tool to your model, specifying the join output as the input table.

The field mapping may not update correctly within this tool at first.  It should show all fields and not just the visible ones.  After setting all the parameters within this tool, validate your model (Model > Validate Entire Model).  Then, click on the Table to Table tool within your model again.  You should now see all fields listed.  You can then delete the fields you don't want.

After the field mapping is updated, you can use the Table to Excel tool to create the final output.

View solution in original post

3 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Jeff,

The Make Feature Layer and Make Table View tools only hide the fields, they don't actually delete them.  What I would recommend doing is adding the 'Table to Table' tool to your model, specifying the join output as the input table.

The field mapping may not update correctly within this tool at first.  It should show all fields and not just the visible ones.  After setting all the parameters within this tool, validate your model (Model > Validate Entire Model).  Then, click on the Table to Table tool within your model again.  You should now see all fields listed.  You can then delete the fields you don't want.

After the field mapping is updated, you can use the Table to Excel tool to create the final output.

JeffGodfrey
New Contributor II

Jake

Thanks for the help.  The table to table tool let me remove unwanted fields from my final product, the excel spreadsheet.

Thanks

Jeff

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Great, glad this worked for you.  If you get a chance, please mark this thread as answered to help other users in the community.  Thanks!

0 Kudos