Only create excel files from specified expression.

529
1
Jump to solution
06-25-2019 07:58 AM
BrandonPetry2
New Contributor II

I have built a model that iterates through my feature classes while only selecting attributes that have a specified expression and exports the tables to excel.  Hopefully that made sense.  The model works and excel files are created with only the attributes that pertain to my expression.

My problem is that it creates excel files for every feature class even if there is no data, (No data since there is an expression).   How/where can I add in another option to only export files that have my specified expression?

Below and attached is a view of the model.

Model Builder Image

To sum it up (easily), the tool as it stands, will find 1 feature class with data out of 10 and export 10 feature classes.  It needs to only export the feature class with the data.

My thought is having a statement, "if table has data, then export to excel", but I am not sure how to add this.

0 Kudos
1 Solution

Accepted Solutions
BrandonPetry2
New Contributor II

Well if any one else ends up with this problem I found a simple solution. The "Get Count" tool added after my "Iterated Output" counts all tables that have rows with data.  Setting the output of "Get Count" as a precondition for "Table To Excel" only produces excel tables with data.

Final Tool

View solution in original post

0 Kudos
1 Reply
BrandonPetry2
New Contributor II

Well if any one else ends up with this problem I found a simple solution. The "Get Count" tool added after my "Iterated Output" counts all tables that have rows with data.  Setting the output of "Get Count" as a precondition for "Table To Excel" only produces excel tables with data.

Final Tool

0 Kudos