Calculate Value (Model Tools)
Summary
Returns a value based on a specified Python or ArcGIS Arcade expression.
Usage
This tool is only available from ModelBuilder for use in models. The tool is not available from the Geoprocessing pane or from Python.
In Python, use the Expression parameter for short one line expressions. Use the Code Block parameter for more complex expressions, such as multiline calculations or logical operations. The Code Block parameter cannot be used on its own; it must be used in conjunction with the Python Expression Type parameter.
In Python, variables created in ModelBuilder can be used by this tool, but they cannot be used directly in the Expression parameter. To use a variable in the expression, enclose the variable name in percent signs (%) or double-click the variable name in the Variables list to add it to the Expression parameter.
To use a Python function in an expression, double-click a function in the Functions list to add it to the Expression parameter.

You cannot access model variables in the Code Block parameter. These variables must be passed to the code block from the expression. To do this, create a function definition (
defstatement) in the Code Block parameter and reference the definition in the Expression parameter.The Data Type parameter is used in ModelBuilder to support chaining the output of this tool with other tools. For example, to calculate a distance for use as input to the Buffer tool's Buffer Distance parameter, set this tool's Data Type parameter to Linear Unit.
In Python, proper indentation is part of the syntax. The indentation level (two spaces or four spaces) does not matter as long as it is consistent throughout the code block.
For Arcade calculations, use the Expression parameter for all types of expressions, including short, complex, and logical operations. To use a variable in the expression, double-click a variable in the Variables list to add it to the Expression parameter.
To use an Arcade function in an expression, double-click a function in the Functions list to add it to the Expression parameter.
Parameters
| Label | Explanation | Data type |
|---|---|---|
|
Expression Type |
Specifies the type of expression that will be used.
|
String |
|
Expression |
The Python or Arcade expression that will be evaluated. For Python expressions, use the Expression parameter for short one line expressions. Use the Code Block parameter for more complex expressions, such as multiline calculations or logical operations. The Code Block parameter cannot be used on its own; it must be used in conjunction with the Expression parameter. For Arcade expressions use the Expression parameter for all types of expressions, including short, complex, and logical operations. |
SQL Expression |
|
Code Block (Optional) |
A Python code block. Reference the code in the code block using the Expression parameter. |
String |
|
Data type (Optional) |
Specifies the data type of the return value of the Python expression. This parameter supports chaining the output of the Calculate Value tool with other tools in ModelBuilder.
|
String |
Derived output
| Label | Explanation | Data type |
|---|---|---|
|
Value |
The calculated value. |
Data Element; Layer; Table View |
Environments
This tool does not use any geoprocessing environments.
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes