I'm doing an iteration process to solve different shortest paths for different combinations of points. But the iteration stops when there is no solution for one combination. I think I may need if-else statement to check if solve fails, so I create a boolean variable "Terminate on solve error" to make it go through next step, but it still stuck at solve.
I'm new to python so don't know how to achieve this function. I attach the errors and part of the model in the screenshots. Does anyone have suggestions?
You mention python, but your screenshot shows Model Builder. I'll try to answer this question for both.
In Model Builder, you can use that Solve Succeeded turquoise-colored bubble as a precondition for the next step in your workflow, I think. If it's false, it should just skip whatever comes next.
In python, you can use try/except:
print("Solve failed. Error messages:")
Thank you for your help!
Yes I'm using the model builder and if it's possible, I want to achieve this without python. but if not, I'll try python code.
I just tried to use it as precondition of "Select Data" but the process still stuck at "Solve". It seems to me that the process is not able to go through "Solve" so that I can't use the parameter that "Solve" generates.
Can you tell me what should I do to insert this python code into this model? Shall I insert the python code by "Calculate Value"?