Hi,
I have two columns in my table: 'Join_Count' and 'SEG_Count'.
I am trying to use the 'Calculate Field' tool so that if the number in the 'SEG_Count' column is higher than the number shown in the 'Join_Count' column, calculate field will change the number in the 'SEG_Count' column to be whatever number is shown in the 'Join_Count' column; however I cannot work out the Python script to do this.
Any help would be appreciated,
Thanks in advance.
Solved! Go to Solution.
Do the calculation on the SEG_Count field with the following settings (I assumed that there are no Null values in these fields):
Parser: Python
Code Block: Checked
Pre-Logic Code Block
def SEG_Count_Cap(SEG_Count, Join_Count):
if SEG_Count > Join_Count:
return Join_Count
else:
return SEG_Count
SEG_Count:
SEG_Count_Cap(!SEG_Count!, !Join_Count!)
Do the calculation on the SEG_Count field with the following settings (I assumed that there are no Null values in these fields):
Parser: Python
Code Block: Checked
Pre-Logic Code Block
def SEG_Count_Cap(SEG_Count, Join_Count):
if SEG_Count > Join_Count:
return Join_Count
else:
return SEG_Count
SEG_Count:
SEG_Count_Cap(!SEG_Count!, !Join_Count!)
Many thanks Richard!