ModelBuilder with precondition in batch mode fail

Discussion created by BillyBuerger on Sep 5, 2013
I have a model that recalculates and applies a new spatial index to a feature class which came from the discussion [url=]Batch recalculate spatial index[/url].  One issue I had with it is that it would fail if the feature class didn't have any features.  When running a batch, this would suck as it would come across an empty feature class then stop.  So I added a precondition to use Get Count to check that the number of rows wasn't 0.  Works great on a single class.  If it's empty, it indicates that the precondition fails and skips the spatial index stuff instead of throwing an error.

Now, run this in batch mode with two feature classes, one with features and one without.  If the one without features is first, then the precondition fails on both and nothing happens.  If the one with features is first, then the precondition passes and both run which causes it to error on the empty class.  You would think that running in batch means run the model X amount of times with the different input values.  But it would appear there is something that crosses between inputs that causes a precondition result from one input to be applied to all input.

Attached is a test toolbox with the model in it.  Has anybody else noticed this issue?  Is there some option or setting that is missing that would allow this to work?  In the end, I created a python script that does the same thing and that works in batch mode just fine.  Ran into some issues with python as well, but that's a discussion for another day.