4

I am relatively new to ModelBuilder and null in python. I want to include Merge tool in my model. However:

  • at run 1, I want to Merge shapefiles s1 and s2
  • at run 2, I want to Merge shapefiles s1, s2 and s3
  • at run 3, I want to Merge shapefiles s1, s2, s3 and s4 etc.

How can I include this to my modelbuilder model? I know how to make it manually, but how to make it in the model?

I can't just set the "Merge" as Parameter, and I don't see to option to make it via "Make Variable".

How the model looks like: enter image description here

Exported python snippet :

arcpy.InfestationGradient("C:/Default.gdb/bb05","C:/Default.gdb/bb06","C:/Default.gdb/forest05","C:/infestGradient.gdb/buff_bb_t2","C:/infestGradient.gdb/buff_forest_t2","C://Default.gdb/bb05_Merge")
  • Can you convert the model to a python script? It might be easier in python. – Mattropolis Jun 15 '17 at 17:26
  • What does this part of your model look like in a test model? – PolyGeo Jun 15 '17 at 20:39
  • 1
    If I understand the question (and it is likely at this point that I do not), you may be able to do it with 3 different models but I don't think you can have a single model determine which run you are doing and select inputs accordingly. – jbchurchill Jun 16 '17 at 12:41
  • Thank you @jbchurchill, tahts what I thougth... I used three models, where I used "merge" with 2 items, 3 items and 4 items, accordingly. I was just wondering, if it is possible to do it more automaticaly – maycca Jun 19 '17 at 8:44
2
+50

If I have understood your question, simply right click on the Merge tool and go to Make Variable > From Parameter > Input Datasets and then make that a Parameter. You probably need to delete the existing links to the Merge tool to see it.

Looking at your model is appears you have have added BB year t1 then S1 and S2 as variables to the model then connected them to the Merge tool. Wrong way of doing it. Expose the Parameter as described above, this provides you with the interface for adding as many layers you wish. You could even partially fill it with your BB year t1.

  • Awesome !! I wonder why I always missed this option: Merge tool -> Make Variable > From Parameter > Input Datasets. Thank you !! :-D – maycca Oct 16 '17 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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