I have a number of point features in a map in ArcMap 10.6 that I would need to label based on information form three fields (Test1, Test2 and Test3) with numeric values. The labels from these 3 fields would have to be stacked. And each of these labels would have to appended with a date text. The format of the label would be something like this;
Some of the records in these fields contain zero values and so it would be required to loop through these fields and skip the zero values. That is not to have them displayed in the label. Currently I have the following scripts to work with;
-script to stack labels -This does not skip through zero values
def FindLabel ([Test1] , [Test2] , [Test3]):
return "05/10/2018" + " - " + [Test1] + "\r\n" + "05/10/2018" + " - " + [Test2] + "\r\n" + "05/10/2018" + " - " + [Test3]
-script to skip "0" values in the fields and stacks the labels, however does not append text string to each attribute value.
def FindLabel ( [Test1] , [Test2] , [Test3] ):
fields = ([Test1] , [Test2] , [Test3])
label = ""
for field in fields:
if field == "0":
continue
else:
label = label + field + "\n"
return label
Is there a way achieve this using a python label expression in ArcMap 10.6
if field == 0: