Examples of using the Calculate Value tool with ArcGIS Arcade

The Calculate Value tool is a versatile ModelBuilder tool that returns a value from an ArcGIS Arcade or Python expression.

Expression

You can perform a variety of calculations using the Expression parameter.

Math

The Calculate Value tool supports the Arcade Max function to get the largest values from a set of numbers.

Returns the largest value from an array of numbers.

var values = [-193, 0, 42, 40, 90];
return Max(values);

Arcade Max function in the Calculate Value tool

If-then-else

The Expression parameter can also take in values from input variables. In the example below, the if keyword defines a block of statements to run if a condition evaluates to true. The else keyword defines a block of statements to run if the condition is false. The condition must evaluate to either true or false; otherwise, the expression will fail.

The example below evaluates whether the defined input variable is greater than 50, and returns a comment when true; otherwise, it returns a different comment.

If-then-else expression in the Calculate Value tool

Related topics


In this topic
  1. Expression