# Incorporating Length of Route Value into Cost Evaluator Function (ArcGIS Network Analyst)? [closed]

A friend and I (who more frequently than I posts on this board) are creating a walking network and we have run in to a snag. We would like to attribute a cost evaluator to our network dataset using a self determined safety metric. We have the equation set up so that all we need to do is divide a field value based on the length of a route to get our "safety value". We just need to know in the cost field how to write the vb script or other evaluator so that Cost Value=[FieldValue]/"total length of individual route". Each route length will be different once each analysis is run, but we have a length value for each line segment, so we know there should be a way that adds up these pieces for the route for a total route length that can be divided by our field value. It seems like it should be a simple script line or something to put in the field evaluator box. Any suggestions?

Thanks

-

## closed as unclear what you're asking by PolyGeo♦, whuber♦Dec 26 '13 at 14:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâ€™s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

I was able to get this to work, but I lack the necessary programming skills to get it 100% correct. I calculated my value by multiplying the length of each segment by a designated number, where 1 was most desirable. Theoretically, when divided by the length, this would produce a value that, the closer to 1 would indicate a more desirable route. In the field evaluator value dialogue box, I was able divide my calculated value by the length of the segment. I was hoping that they would sum each field first and then divide the two values. – eric Nov 23 '10 at 5:51
However, when I ran the route analysis, the values were dividing each time, and summing all of the individually divided values at the end. I would like each field (my value and the length) to sum first, then divide the two summed fields to produce a value. What would be the VB sript or other relevant code to put in the Prelogic or VB function dialogue box to have them run in this order instead of the order they currently are? – eric Nov 23 '10 at 5:51
Is this still an issue at ArcGIS 10.1? If so, could you perhaps post your VB/Python code so far, please? – PolyGeo Jan 23 '13 at 11:03
Did you solve this? If so please post an answer. – Oliver Burdekin Jul 15 '13 at 15:53
This appears to be a similar question to gis.stackexchange.com/questions/72643/… – PolyGeo Oct 9 '13 at 8:37