Can anyone help me create a codeblock using an if/then statement through the Python parser in Field Calculator, to calculate the length of a line segment when the value of a different field is a certain value?
I am trying to calculate percentages of Passing Zones within Undivided 2-Lane State Highways. I have one field
[PassingZoneDesc] with values
"None". I have added fields for each type of Passing Zone, and would like to create an expression in Field Calculator that goes along the lines of
If [PassingZoneDesc] = "Left" Then [Length_NPZ_Left] = !Shape.Length@Miles! else [Length_NPZ_Left] = 0.
I understand the above is a messed-up mash of VB Script and Python. Frankly, I am more familiar with VB Script but apparently ArcMap only supports geometry calculations in Field Calculator with Python now (hence the Python length calculation above). I know there are workarounds available, but I'm just wondering if there is a way to calculate the lengths in this manner.
I am not permitted to upload an actual sample of the data, but here is a screenshot of the attribute table and a draft code I was trying to use.