Skip to main content

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.

    Calculate Value Tool with Variable and Functions list

  • 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 (def statement) 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.

  • Python—The Python expression type will be used.

  • Arcade—The Arcade expression type 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.

  • 3D Object Feature Layer—3D Object Feature Layer

  • 3D Tiles Layer—3D Tiles Layer

  • Address Locator—Address Locator

  • Analysis Cell Size—Analysis Cell Size

  • Annotation Layer—Annotation Layer

  • Any Value—Any Value

  • ArcMap Document—ArcMap Document

  • Areal Unit—Areal Unit

  • BIM File Workspace—BIM File Workspace

  • Boolean—Boolean

  • Building Discipline Layer—Building Discipline Layer

  • Building Scene Discipline Layer—Building Scene Discipline Layer

  • Building Layer—Building Layer

  • Building Scene Layer—Building Scene Layer

  • CAD Drawing Dataset—CAD Drawing Dataset

  • Calculator Expression—Calculator Expression

  • Catalog Layer—Catalog Layer

  • Catalog Root—Catalog Root

  • Cell Size—Cell Size

  • Cell Size XY—Cell Size XY

  • Composite Layer—Composite Layer

  • Compression—Compression

  • Coordinate System—Coordinate System

  • Coordinate Systems Folder—Coordinate Systems Folder

  • Coverage—Coverage

  • Coverage Feature Class—Coverage Feature Class

  • Data Element—Data Element

  • Data File—Data File

  • Database Connections—Database Connections

  • Dataset—Dataset

  • Date—Date

  • dBASE Table—dBASE Table

  • Decimate—Decimate

  • Diagram Layer—Diagram Layer

  • Dimension Layer—Dimension Layer

  • Disk Connection—Disk Connection

  • Double—Double

  • Elevation Surface Layer—Elevation Surface Layer

  • Encrypted String—Encrypted String

  • Envelope—Envelope

  • Evaluation Scale—Evaluation Scale

  • Extent—Extent

  • Extract Values—Extract Values

  • Feature Class—Feature Class

  • Feature Dataset—Feature Dataset

  • Feature Layer—Feature Layer

  • Feature Set—Feature Set

  • Field—Field

  • Field Info—Field Info

  • Field Mappings—Field Mappings

  • File—File

  • Folder—Folder

  • Formulated Raster—Formulated Raster

  • Fuzzy Function—Fuzzy Function

  • GeoDataServer—GeoDataServer

  • Geodataset—Geodataset

  • Geometric Network—Geometric Network

  • Geostatistical Layer—Geostatistical Layer

  • Geostatistical Search Neighborhood—Geostatistical Search Neighborhood

  • Geostatistical Value Table—Geostatistical Value Table

  • GlobeServer—GlobeServer

  • GPServer—GPServer

  • Graph—Graph

  • Graph Data Table—Graph Data Table

  • Graphics Layer—Graphics Layer

  • Group Layer—Group Layer

  • Horizontal Factor—Horizontal Factor

  • Image Service—Image Service

  • Index—Index

  • INFO Expression—INFO Expression

  • INFO Item—INFO Item

  • INFO Table—INFO Table

  • Internet Tiled Layer—Internet Tiled Layer

  • KML Layer—KML Layer

  • Knowledge Graph Layer—Knowledge Graph Layer

  • LAS Dataset—LAS Dataset

  • LAS Dataset Layer—LAS Dataset Layer

  • Layer—Layer

  • Layer File—Layer File

  • Layout—Layout

  • Line—Line

  • Linear Unit—Linear Unit

  • Long—Long

  • M Domain—M Domain

  • Map—Map

  • Map Server—Map Server

  • Map Server Layer—Map Server Layer

  • Mosaic Dataset—Mosaic Dataset

  • Mosaic Layer—Mosaic Layer

  • Neighborhood—Neighborhood

  • Network Analyst Class FieldMap—Network Analyst Class FieldMap

  • Network Analyst Hierarchy Settings—Network Analyst Hierarchy Settings

  • Network Analyst Layer—Network Analyst Layer

  • Network Data Source—Network Data Source

  • Network Dataset—Network Dataset

  • Network Dataset Layer—Network Dataset Layer

  • Network Travel Mode—Network Travel Mode

  • Oriented Imagery Layer—Oriented Imagery Layer

  • Pairwise Weights Table—Pairwise Weights Table

  • Parcel Fabric—Parcel Fabric

  • Parcel Fabric for ArcMap—Parcel Fabric for ArcMap

  • Parcel Fabric Layer for ArcMap—Parcel Fabric Layer for ArcMap

  • Parcel Layer—Parcel Layer

  • Point—Point

  • Polygon—Polygon

  • Projection File—Projection File

  • Pyramid—Pyramid

  • Radius—Radius

  • Random Number Generator—Random Number Generator

  • Raster Band—Raster Band

  • Raster Calculator Expression—Raster Calculator Expression

  • Raster Catalog—Raster Catalog

  • Raster Catalog Layer—Raster Catalog Layer

  • Raster Data Layer—Raster Data Layer

  • Raster Dataset—Raster Dataset

  • Raster Layer—Raster Layer

  • Raster Statistics—Raster Statistics

  • Raster Type—Raster Type

  • Record Set—Record Set

  • Relationship Class—Relationship Class

  • Remap—Remap

  • Report—Report

  • Route Measure Event Properties—Route Measure Event Properties

  • Scene Layer—Scene Layer

  • Semivariogram—Semivariogram

  • ServerConnection—ServerConnection

  • Shapefile—Shapefile

  • Spatial Reference—Spatial Reference

  • SQL Expression—SQL Expression

  • String—String

  • String Hidden—String Hidden

  • Table—Table

  • Table View—Table View

  • Terrain Layer—Terrain Layer

  • Text File—Text File

  • Tile Size—Tile Size

  • Time Configuration—Time Configuration

  • Time Unit—Time Unit

  • TIN—TIN

  • TIN Layer—TIN Layer

  • Tool—Tool

  • Toolbox—Toolbox

  • Topo Features—Topo Features

  • Topology—Topology

  • Topology Layer—Topology Layer

  • Trace Network—Trace Network

  • Trace Network Layer—Trace Network Layer

  • Trajectory Layer—Trajectory Layer

  • Transformation Function—Transformation Function

  • Utility Network—Utility Network

  • Utility Network Layer—Utility Network Layer

  • Variant—Variant

  • Vector Tile Layer—Vector Tile Layer

  • Vertical Factor—Vertical Factor

  • Voxel Layer—Voxel Layer

  • VPF Coverage—VPF Coverage

  • VPF Table—VPF Table

  • WCS Coverage—WCS Coverage

  • Weighted Overlay Table—Weighted Overlay Table

  • Weighted Sum—Weighted Sum

  • WMS Map—WMS Map

  • WMTS Layer—WMTS Layer

  • Workspace—Workspace

  • XY Domain—XY Domain

  • Z Domain—Z Domain

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