AnsweredAssumed Answered

Python If Then label expression

Question asked by granthay on Jan 22, 2017
Latest reply on Jan 23, 2017 by tkowal

I need to label some wells with their ID and the sulfate concentrations from multiple sampling events. I started by labeling the wells from just one event, I wrote a python expression that would label a well with its name and the sulfate concentration in red if its over 300,000. The expression has no errors but it labels all the sulfate concentrations in red regardless of the number. It also breaks up the label wherever there is a comma. I know I could do this in SQL, but eventually I need to add multiple sulfate concentrations to this label.


def FindLabel ( [Well_Nme], [Sulfate_9_2016] ):
if ([Sulfate_9_2016]) >300000:
return [Well_Nme] +'\r\n'+ "<CLR red='255'>" + [Sulfate_9_2016] + "</CLR>"
elif [Sulfate_9_2016] <300000:
return [Well_Nme]+'\r\n'+ [Sulfate_9_2016]