How to use this formula in field calcultor in ArcMap. for example: A = Field1 B = Field2
if A =<B
C = B
else:
C = A
How to use this formula in field calcultor in ArcMap. for example: A = Field1 B = Field2
if A =<B
C = B
else:
C = A
@Vince is right and this could be solved using the max(!A!, !B!) expression. However, if you had a more complex situation you could use a custom function. In Arcmap you can write a function on the code block space and then call it where you usually write the expression.
Your function (code block) could look something like:
my_function(field1_value, field2_value):
if field1_value <= field2_value:
return field2_value
else:
return field1_value
Then you can call it using the following expression:
my_function(!A!, !B!)
Of course, you need to specify Python as the parser.
Nonethis is the same as the trivial Python expressionmax(!A!,!B!). The documentation for Field Calculator has multiple examples, and the UI tool will help you build the function. Please make an attempt, then [Edit] the question to reflect any problem you may encounter. – Vince Apr 10 '20 at 13:31