Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Label expression concatenate and round

$
0
0
Hello,

I am trying to format half of my label red where it exceeds a set limit.

However, when I try and round the Field2 (which is numeric with many decimals) the python code does not allow me to concatenate.

any suggestions?

def FindLabel ( [Field1], [Field2] ):
if [Field2] >= 1:
return "# " + [Field1] + "<CLR red='255'><FNT size = '16'>" + ", Field 2 " + round(float([Field2], 2) + "</FNT></CLR>"
else:
return "# " + [Field1] + ", Field 2 " + round([Field2],2)

Would very much appreciate any help with this simple task.

Viewing all articles
Browse latest Browse all 2485

Trending Articles