Select to view content in your preferred language

please help: label expression

3009
2
Jump to solution
07-22-2015 11:31 AM
NidaJackson
Emerging Contributor

Hi Everyone,

I need some help. I am not a python expert nor a programmer but I am a GIS user. Trying to learn python scripting for now.

This is what I am trying to make an expression in python:

1.JPG

I try this:

def FindLabel ( [POLY_ID], [EV_CODE], [STAND_CONDITION_CODE] 😞

  return "<BOL><UND>" + "  " +  [POLY_ID] + "   " +  "</UND></BOL>" + '\n' + [EV_CODE] + "-" + [STAND_CONDITION_CODE]

And I want,

if [EV_CODE] and  [STAND_CONDITION_CODE] is None:

  return "?"

Is anyone can help me create an expression for this label?

Your responses is highly appreciated.

Thank you,

nidz

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
MVP Alum

It should be something like this (untested):

def FindLabel ( [POLY_ID], [EV_CODE], [STAND_CONDITION_CODE] ):
  if [STAND_CONDITION_CODE]:
      SCC = [STAND_CONDITION_CODE]
  else:
      SCC = '?'
  if [EV_CODE]:
      EC = [EV_CODE]
  else:
      EC = '?'
  return "<BOL><UND>" + "  " +  [POLY_ID] + "  " +  "</UND></BOL>" + '\n' + EC + "-" + SCC

View solution in original post

2 Replies
DarrenWiens2
MVP Alum

It should be something like this (untested):

def FindLabel ( [POLY_ID], [EV_CODE], [STAND_CONDITION_CODE] ):
  if [STAND_CONDITION_CODE]:
      SCC = [STAND_CONDITION_CODE]
  else:
      SCC = '?'
  if [EV_CODE]:
      EC = [EV_CODE]
  else:
      EC = '?'
  return "<BOL><UND>" + "  " +  [POLY_ID] + "  " +  "</UND></BOL>" + '\n' + EC + "-" + SCC
NidaJackson
Emerging Contributor

Hi Daren,

Thank you so much for your reply.

Excellent. It is perfectly working.

I am so grateful that you responded my post.

-nidz

0 Kudos