To create an expression (Procedure)

Autodesk Expression Builder

 
Overview of Creating Expressions
Concept Procedure
 
 
 

To create an expression

  1. Select the feature classes or feature layers to which the expression will apply and the action that will be affected by the query.

    For example, in the AutoCAD Map 3D Display Manager, right-click a layer and click Query to Filter Data. This specifies the layer you right-clicked as the data source for the expression and indicates that only the data in that layer that matches your expression’s conditions will be displayed.

  2. In the window that displays, insert the elements that comprise the expression.

    If the expression startup page is turned on, buttons representing different expression types are displayed. You can click one of these buttons to insert an expression template.

    Click one of these buttons to start with a sample expression.

  3. In the expression area, do any of the following to build your expression:
    • Click an element in the expression to replace it with a property, value, or operator. See Selecting Property Values from a List for information on viewing and selecting properties.

      Click an element to see a menu of options for replacing or deleting it.

    • Use commands and icons to add elements.

      Use the menus and buttons at the top of the window to insert elements.

    • If you know the names of the properties, values, and operators you want, enter them directly.

      All expressions are text-based.

    An expression can combine operations in many ways. For example, you can calculate the area of all parcels and then find features that have the StreetName “Elm” and are larger than 20,000 square feet.

  4. In building your expression, you can do any of the following:
    • Evaluate the value of a property. For example, find features on a Parcels layer whose StreetName property is “Elm.” That expression would look like this:

      ST_NAME = 'ELM St'

    • Perform a calculation, and then evaluate the result of the calculation. For example, first determine the area of parcels, and then find parcels with an area smaller than a value you specify. That expression would look like this:

      Area2D (Geometry) < 12000

      NoteThe Geometry property may have a different name in your data store. It is always listed under Geometry Properties in the Property list. Insert the property from the list. Do not change it manually or substitute a value for this property.
    • Perform a converson, and then evaluate the result of the conversion. For example, convert a parcel property called Purchase_Date from a text string to a date string, and then find parcels purchased before a date you specify. That expression would look like this:

      ToDate (PURCHASE_DATE, MM/DD/YYYY) AND PURCHASE_DATE < 01/01/2005

      NoteSee Using Dates in Expressions for information about date formatting.
    • Create a text expression. For example, you can label a layer representing roads with the street name and suffix (for example, “Portobello Road” or “Fifth Avenue”). That expression would look like this:

      Concat (ST_NAME, SUFFIX)

    • Create a numeric expression. For example, you can round off repair costs to the next highest dollar. That expression would look like this:

      Ceil (REPAIR_COST)

    • Filter by location. For example, you can find all parcels within or touching a circle that you draw on the map.
  5. Validate the expression by clicking Validate (at the bottom of the window).

    Validation checks the syntax of the expression only. It does not check whether the values you specified are valid for the data, or whether the results are as expected. If there are validation problems, an error message helps direct you to their solutions.

  6. To reuse your expression later, save it using the Options menu (at the bottom of the window).
  7. To apply your expression, click OK.
  8. To set expression options, use the Options menu.