Select to view content in your preferred language

Update Field with condition not working

506
1
Jump to solution
08-28-2023 01:40 PM
Labels (2)
rajujee
Emerging Contributor

Hi,

I spent half day and didn't resolve issue. I need to update field Grave if it is null. My code is below. I am using python. I have attached error details. please help!

Logic

def myfun(myvalue):
if myvalue != !ABC_ID!:
return !ABC_NO!

Field

Grave=myfun(!H_No!)

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Notable Contributor

How to insert code....

You didn't say what you  want to update to if Null.  So, this updates to the value in ABC_NO field.

def myfun(myvalue,retvalue):
    if myvalue is None:
        return retvalue
    else: 
        return myvalue

Field Grave=
    
myfun(!Grave!,!ABC_NO!)

 

R_

View solution in original post

1 Reply
RhettZufelt
MVP Notable Contributor

How to insert code....

You didn't say what you  want to update to if Null.  So, this updates to the value in ABC_NO field.

def myfun(myvalue,retvalue):
    if myvalue is None:
        return retvalue
    else: 
        return myvalue

Field Grave=
    
myfun(!Grave!,!ABC_NO!)

 

R_