Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a simple calculation to compare two columns and populate a new column with the lower value but I am getting null output...any ideas?

expression

re_score(!Signal_Strength!,!Signal_Strength_1!,out1)

code block

out1='99'
def re_score(f1,f2,out1):
 if f1<f2:
  out1 = f1
 else:
  out1=f2
 return out1

WARNING 000405: No records within table Succeeded at Tue Mar 06 15:13:45 2012 (Elapsed Time: 7.00 seconds)

share|improve this question
    
What is out1 is for, and why does it appear in strange places? –  Mike T Mar 6 '12 at 5:34
add comment

1 Answer

up vote 1 down vote accepted

You can evaluate your expression using a simple inline-if statement (does not require codeblock):

!Signal_Strength! if !Signal_Strength! < !Signal_Strength_1! else !Signal_Strength_1!

Or rework your codeblock:

def re_score(f1,f2):
    if f1 < f2:
        out1 = f1
    else:
        out1 = f2
    return out1

with expression:

re_score(!Signal_Strength!, !Signal_Strength_1!)
share|improve this answer
    
thanks...it was a dataset issue where the model was not updating itself properly. I added out1 in "strange"/extra places for error trapping - I could search for 99. –  GeorgeC Mar 6 '12 at 6:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.