I have a large set of data with lab results that I'm looking to label in ArcMap. I'm trying to build a label expression that needs to produce a label that essentially needs to look like this:
B=5
T=10
E=200
So if B [BEN] is >= to 5, it will produce text that is bolded and red. If B is < 5, it will come out green, and if it is anything else it will come out B=ND. This is the code I have so far to do that, and it works:
def FindLabel ([BEN]):
if float([BEN]) >= 5:
return "<CLR red='255'><FNT size = '8'><BOL>" + "B=" + [BEN] + "</BOL></FNT></CLR>"
elif float([BEN]) < 5:
return"<CLR green='255'><FNT size = '8'>" + "B=" + [BEN] + "</FNT></CLR>"
else:
return "<CLR green='255'><FNT size = '8'>" + "B=ND" + "</FNT></CLR>"
The problem is that I also need to do this for compounds T, E, and so on...If I didn't want to use the if/else it would be simple, I could use something like:
return "B=" + [BEN] + "\n" + "E=" + [ETH] + "\n" + "T" + [TOL] + "\n" + "I=" + [ISO]
I basically need to have stacked labels (as shown above) while using the If/Then statements, and I'm really blanking on how to do this.