Return a second field

253
3
Jump to solution
03-05-2021 06:10 AM
Labels (1)
GordonBaker
New Contributor II

I am trying to build out my label field. I successfully got the function to return a value. I want to go one step further and reference a second field. Is that possible. If the Location ID is valid I want to return the location code.

Office(!Location_IDs!)
def Office(Location_IDs):
if (Location_IDs>= -1):
return ""
else:
return LOC_CODE

0 Kudos
2 Solutions

Accepted Solutions
DavidPike
MVP Frequent Contributor

You can add as many parameters as you like to your function:

 

Office(!Location_IDs!, !LOC_CODE!)

def Office(Location_ID, LOC_CODE):
    if (Location_ID >= -1):
        return ""
    else:
        return LOC_CODE

View solution in original post

JoeBorgione
MVP Esteemed Contributor

Try this?

 

Office(!Location_IDs!,!LOC_CODE!)
def Office(Location_IDs,LOC_CODE):
    if (Location_IDs>= -1):
        return ""
    else:
        return LOC_CODE

 

hahaha: @DavidPike beat me by a few seconds!

 

That should just about do it....

View solution in original post

3 Replies
DavidPike
MVP Frequent Contributor

You can add as many parameters as you like to your function:

 

Office(!Location_IDs!, !LOC_CODE!)

def Office(Location_ID, LOC_CODE):
    if (Location_ID >= -1):
        return ""
    else:
        return LOC_CODE
JoeBorgione
MVP Esteemed Contributor

Try this?

 

Office(!Location_IDs!,!LOC_CODE!)
def Office(Location_IDs,LOC_CODE):
    if (Location_IDs>= -1):
        return ""
    else:
        return LOC_CODE

 

hahaha: @DavidPike beat me by a few seconds!

 

That should just about do it....
DavidPike
MVP Frequent Contributor

looks beautiful Joe!