I'm trying to do something fairly simple (I think) in modelbuilder but I can't wrap my head around how the iterators and logic operators work. Basically, I have a dataset with thousands of points and I want to randomly select one point, then select all the points within a certain distance and store them in a new feature class. The model I've built (picture attached) accomplishes this task up until this point. However, I would like this process to continue repeating itself until the new feature class has a certain number of rows. I was thinking of using the "If Row Count Is" operator, but I don't know where exactly to add it or how to point it to the steps I want repeated. Any help would be appreciated!
Solved! Go to Solution.
The selection part can go in between While and Append tool.
In the image below,
To loop within models you need to be using an iterator. Explore help file and look at the examples.
I think you are almost there, just use the Stop tool (in the utility dropdown in the ribbon) with the variable labeled True at right as the precondition.
Hi @Alyssa_68 , hope the following workflow could help.
In the model below, I am using If Row Count Is tool to check if the input dataset "points" has over than 50 rows. The While tool output is connected to Append tool as Precondition link. This model will keep running and stop when the "points" dataset reaches over 50 rows.
That answer is almost perfect! The only issue is I want to select a random point and then also have any points within a buffered radius also be selected and appended to the dataset. Then, ideally, deleted from the original point dataset so as the model continues iterating, it will select a new random point without any repeats. My initial dataset has a column of random numbers called RandID.
Thanks so much for your help!
The selection part can go in between While and Append tool.
In the image below,