Skip to main content
added 107 characters in body
Source Link
radouxju
  • 49.9k
  • 2
  • 71
  • 144

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10): #if you don't have negative values, it could be if a<10: . Also, note that you will not return any result for negative values with the present script.
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15): #elif a<15:
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15): #else:
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)

By the way, in your example the value of "a" doesn't influence the output, so this could be skipped.

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10): #if you don't have negative values, it could be if a<10: . Also, note that you will not return any result for negative values with the present script.
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15): #elif a<15:
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15): #else:
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10): #if you don't have negative values, it could be if a<10: . Also, note that you will not return any result for negative values with the present script.
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15): #elif a<15:
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15): #else:
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)

By the way, in your example the value of "a" doesn't influence the output, so this could be skipped.

added 170 characters in body
Source Link
radouxju
  • 49.9k
  • 2
  • 71
  • 144

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10): #if you don't have negative values, it could be if a<10: . Also, note that you will not return any result for negative values with the present script.
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15): #elif a<15:
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15): #else:
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10):
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15):
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15):
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10): #if you don't have negative values, it could be if a<10: . Also, note that you will not return any result for negative values with the present script.
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15): #elif a<15:
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15): #else:
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)
Source Link
radouxju
  • 49.9k
  • 2
  • 71
  • 144

Your main problem is the use of "for" instead of "if" with the conditionals related to the first field.

def Check ( a, b ):
 if (a > 0) and (a < 10):
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE" 
 elif (a => 10) and (a < 15):
  if b == 2:
   return "NO"
  elif b == 1:
   return "YES"
  elif b == 0:
   return "MAYBE"
 elif (a > 15):
  if b == 2:
   return "YES"
  elif b == 1:
   return "NO"
  elif b == 0:
   return "MAYBE"

Also, make sure that you run it with

Check(!fielda!,!fieldb!)