AnsweredAssumed Answered

Hatch expression help

Question asked by morsebl on Aug 12, 2013
Latest reply on May 13, 2014 by ischultz
This is driving me crazy and I'm sure its something really simple but I can't find examples to show me what to do so I'm hoping someone here can help me out.  I have a route with measures that I'm trying to format into 123+45

I ran this in PythonWin just to make sure I had this part right:

import arcpy
station = "37000"
rs = station[-2:]
ls = station[:-2]
print ls + "+" + rs

it gave me this:


just what I'm trying to do.  So then I go to the Hatch Text Expression dialogue and hit advanced.  First thing I probably need to know is what FindLabel is doing?  I looked around on the internet  trying to find it and still I'm not very sure.  Could be I just suck at the internet though.  I'm guessing the statement def FindLabel ( esri_measure) just lists the arguments you're going to use below it.  Does it make a string or is it a still a number?

So far in the advanced box I can get this much to work:

def FindLabel ( esri__measure ):
  return str(int(esri__measure))

and it seems to return a value with no decimals just fine.

But when I start trying to add to that to get my 123+45 format it keeps giving me the error "No features found.  Could not verify expression."

This is going to have a lot to do with my inexperience using Python this way and my inexperience with Python in general I'm sure, but I haven't been able to find any good examples on the internet to help me puzzle this out or explain it to me.

If someone could show me how to enter this into the advanced expression box or point me to some good examples so I can figure it out myself that would be great.

Thanks in advance!