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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Oct 6, 2017 at 18:35
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? Commented 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. Commented 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.

answered Nov 10, 2017 at 11:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.