Use Expressions

An expression is a way to specify conditions. For example, you can create an expression that specifies all buildings whose area is larger than 4000 square feet. When you use Select by Filter, that expression selects only buildings that are larger than 4000 square feet.

Use expressions in the following situations:

The Expression Editor can calculate values, based on existing properties. It can convert data from one data type to another. Use text expressions to format text strings. Use numeric expressions to apply math functions to properties with numeric values.

The title bar for the dialog box in which you create expressions is different, depending on the command you choose. The contents of the dialog box are much the same, no matter what it is called.

The text in the title bar changes, depending on which command you select.

Use expressions in the following ways:

Ways to Use Expressions Description
Evaluating Properties

You can filter or select data based on the value of one or more properties.

A simple expression evaluates a single property, but you can create complex expressions that use multiple properties or multiple values. For example, you could create an expression that shows buildings with a roof height over 18 but under 32.

The result of a filter expression must be a Boolean value.

Creating a Calculation

You can calculate a new value based on existing values. For example, you can do the following:

  • Calculate the area of a polygon or the length of a linear feature.
  • Convert a text string to a date format and add days or months to the resulting date.
Performing a Conversion

Conversions change data values from one data type to another. For example, if a data store keeps date values as text, you can convert these values to date strings. Then you can use Date Functions on them.

You can also convert numeric or text strings to a particular numeric format, for example to a single- or double-precision number. You can convert numeric values into text strings, for example, to extract a substring or find the number of characters in the string.

Creating Text Expressions

With text expressions, you can analyze and manipulate strings. For example, you can do the following:

  • Concatenate multiple properties into a single entry. For example, concatenate First_Name and Last_Name to get Full_Name.
  • Find the length of a text string, or the position of one text string within another.
  • Convert a text string to all uppercase or lowercase characters.
  • Trim or add to the beginning or end of a text string.
  • Replace one set of characters with another.
Creating Numeric Expressions

Numeric expressions operate only on numeric values. They use math functions, with which you can analyze and manipulate numeric strings. For example, with numeric expressions, you can do the following:

  • Round a value up or down.
  • Find the square root of a value, use trigonometric functions, or determine the remainder of a number after it is divided by another number.
  • Find the average, mean, or median of a set of values.
Using Expressions to Filter Data

With filters, you can work with a subset of your data. For example, if your model includes all the buildings in a city, you can create a filter to show only buildings in the downtown area.

Use expressions to do the following: