SOLUTION: I was able to do it with help of a colleague by creating a list instead, I'm assuming the tuple was was a quirky bug;
def FindLabel ( [PIPE_INTERNAL_DIAMETER] ):
lst = ['1"', '2"']
if [PIPE_INTERNAL_DIAMETER] not in lst:
return [PIPE_INTERNAL_DIAMETER]
else:
return None
I feel like this should be straight forward but it's turning out to be a pain.
Basically, I have a line feature in ArcMap that has a field (size) that is type double.
I wanted to create a label that would exclude all sizes below 2 (2"). Problem is because the field is based on a domain the field value is 2 but to do the python labeling it seems like they are strings (2 equates to 2" in the domain).
I figured I'd just create a label like this following:
def FindLabel ( [PIPE_INTERNAL_DIAMETER] ):
if [PIPE_INTERNAL_DIAMETER] in ('1"', '2"'):
return [PIPE_INTERNAL_DIAMETER]
else:
return None
and only show the diameter values I wanted to show. The problem is it works fine with those two values (1" and 2");
but as soon as I add another value I am getting an error;
I know I could do this fairly easily in a label class but I feel like this should be straight forward to do in a python label too so its kind of bothering me that I cant figure it out. Might anyone shed some light on this for me?