1

I have a model which I would like to check if shapefiles exist or are up to date and download them if they are not before processing them. I wrote the script to do the checking. In the script, I use arcpy.SetParameter() to pass in the file location of my downloaded shapefiles once checking is done and I pass them as derived outputs parameters in the script's properties. My problem is that I am not able to force ModelBuilder to run the script before trying to do anything else. The output shapefiles which I use for processing are none existent until the script is run so I get errors telling me that fields do not exist and such (because of processing steps down the line). Simply put the Model Thinks that I want it to run without input shapefiles when I just want it to wait for them to be obtained. I have tried preconditions but that has not worked, maybe I did it wrong. The answer must be in ModelBuilder, or if it is a python script, it has to be one that I can add to the model, not export my whole model as a script.

2
  • 1
    Did you do the precondition from within the modelbuider? did you attach the script to the process that is running first (when it is not supposed to) and make your script the precondition for your process?
    – yanes
    Oct 6, 2017 at 19:41
  • using python would be ideal. you could create a small script that is used before the rest of the model. this is where you can do your various checks.
    – MacroZED
    Oct 6, 2017 at 20:05

1 Answer 1

1

Without a screen shot showing us where your script tool is in context with the rest of the model it is difficult to speculate. Another way of making things run in order is to use sub-modelling. You place your models within a master model and chain them up that way.

I too have had difficulties with model builder validating and demanding inputs before they get created, a bit of a chicken and egg situation. In those cases I agree with @MacroZED in that I would have abandoned creating the workflow in model builder and moved over to python scripting where you have much better control over the order of operations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.