I'm new to python and would like to use the label expression box with python to display only the odd or even integers from the field, [Frame_Number].
I was thinking something like
def FindLabel ( [Frame_Number] ):
for num in [Frame_Number]:
return num % 2
return [Frame_Number]
But I know that is incomplete.
Best Answer
Label expressions are similar to field calculator: you don't need to use a
for
loop as the expression is already applied to every feature. Also, you'll get an error with your code as per the help:Here it is displaying odd values:
Alternatively, you can use a SQL expression in Label Manager to accomplish the same:
MOD(Frame_Number, 2) = 1