So seeming as how I've had no breakthroughs with my other question (Why isn't my model iterating for all features (2 iterators using sub models)) I thought I'd try another approach.
Now I'm using the While Iterator to try and stop an iteration when a feature class contains X number of rows.
It seems like there aren't many options. Just Inputs and Continue if True/False. I was hoping that if I put both inputs in, then when they matched, it would recognise it as True and stop. Apparently not the case.
I'm guessing I need to include some sort of expression step that passes True/False to the iterator? How would this look?
Solved! Go to Solution.
Never mind. Figured it out myself. Needed to use a "Logical - If Value Is" tool to generate the True/False value which in turn fed into the While Iterator.
Never mind. Figured it out myself. Needed to use a "Logical - If Value Is" tool to generate the True/False value which in turn fed into the While Iterator.
Try using Calculate Value in front of the While.
Make Destination Count and Updated Origin Count into variables and use this expression in Calculate Value:
%Updated Origin Count% == %Destination Count%
This will return True if the counts are equal. So choose that in the While block.
Nevermind, your approach is better.
Honestly, if you get to the point where you need iterations, wouldn't it be easier to just write a little Python script and package that in a script tool?
Thanks for the tip - I'll look at implementing that on Monday. It makes sense to cut down as many steps as possible.
As for python in place of iterators, I could do, but I'm far too novice to be efficient at it, and nobody else here has much python understanding so model builder is an easier solution to troubleshoot/fix should I not be around (in theory).
Actually - just realised that this tip won't quite work in my case. The replication effect I'm going for isn't to match the total number of features already existing in Destinations, but what the total will be once Destinations are Replicated for each unique Origin location too (so a multiplying effect) which is why the Calculate Value is there at all (AxB = C) then test if B=C: false - add another lot on | true - stop iterating.
Yeah, I used the wrong value, sorry. Should have been Target Value instead of Destination Count
And fair point about using Python. When I leave my current job and my scripts and tools stop working for some reason, nobody will be able to fix them. But then again, nobody would be able to fix ModelBuilder either. I'll just have to hope that they keep working...