Update Field with condition not working

328
1
Jump to solution
08-28-2023 01:40 PM
Labels (2)
rajujee
New Contributor III

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 Frequent 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 Frequent 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_