Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using modelbuilder to do upstream traces from several points/flags in a feature class. I'm iterating each point in the fc using the feature selection iterator so that I can calculate/transfer the inline variable/point ID to the trace results. My question is, I have the output of the trace tool connected to the collect values tool which then outputs to the merge tool. I want the merge tool to run only after all points have been iterated/traced and output into the collect values tool. I thought this was the point of the collect values tool, that it would hold/collect all iterations and after the iterations were complete, only then would it continue to the next tool. Currently the model iterates through all tools including the merge tool which then puts the error:

Failed to execute. Parameters are not valid. ERROR 000400: Duplicate inputs are not allowed WARNING 000725: Output Dataset: Dataset E:\Workspace\ScratchWorkspace.gdb\Merged_SSO_Assets already exists. Failed to execute (Merge).

I'm guessing this error is due to a merge being performed at each iteration because when I run each tool individually in sequence, the model runs correctly and w/out errors. I've tried using preconditions but they have not resolved the issue, I could be using the wrong preconditions. Model Screenshot

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You need to put the model up to and including the collects value tool in its own model and expose the collects tool as a parameter. Then put that SUB model into a model and connect its output to your merge tool.

share|improve this answer
    
Hornbydd, thank you for the response. I put all elements up to and including the collect values tool into its own model. When I run this model and view the results by "add to display", the results/trace is shown only for the last iterated feature and not all the iterated features. When I run each tool individually and sequentially, however, starting with the iterator-->trace-->collect values, I get the correct results. Additionally, when I right-click the collect values tool and select make variable, the from parameter is greyed out. –  Steve Jan 14 at 14:12
    
To add to my comment above, when the model is run, it iterates thru each feature but only preserves the last one in the collect values tool. –  Steve Jan 14 at 16:44
    
In that case it sounds like you are inadvertently overwriting the output of your select tools, you need to give each layer a unique name and it is these that are collected. What is your select tool? Are you running the select tool to create a new dataset or is it the attribute\location select tool? Hopefully its the Select data tool as selections cannot be stored in the collects tool. You can make the output have unique names by employing inline substitution. In your case just add %Value% to end of file name, this is coming from your iterator. –  Hornbydd Jan 14 at 21:21
    
If you do not know what inline substitution is then look it up in the help file, it will make much more sense. –  Hornbydd Jan 14 at 21:23
    
Since the trace is done on the entire geometric network, I'm using the select data tool to select just pipes that then output to the collect values tool and then to the merge tool to create a dataset of pipes. I am using inline variable using %value% as you mentioned. Right after the merge tool the model has an add field tool and then the calculate field tool where I input the variable to the new field. I think the overwriting is happening in the trace because when I run the trace, the model iterates thru each feature but the results of the trace are only for the last feature. –  Steve Jan 14 at 21:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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