I am trying to label a field using two fields. Example: "[FieldOne] / [FieldTwo]". But I don't want to show FieldOne if the value is zero. Example: 0 / 1050 should read just 1050 whereas 1/1050 should read as 1/1050.

How do I leave out the zero values from the label?

I have tried a SQL query on the label - example: "Portion <> 0" but that just leaves out the label entirely, not just just the zero from field one.

  • If you do this, how will you know if the value shown is field one or field two when looking at the final map/label? Or would you preserve the slash, so it would be 1050 / 1050, / 1050, or 1050 /? Note that would take three label classes per Alex's answer, or you could create a single label expression that has a nested if statement or two in it. Example of using a single expression with if statements at gis.stackexchange.com/questions/147806 Note you would need to cast the field back to a number as discussed at that question. – Chris W Jun 15 '15 at 22:15

The easiest way to do this probably is to create multiple label classes. Add two classes with the SQL query specified and then have different label expressions for those.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.