Expressions overview, Creating expressions, Expressions overview creating expressions – Pitney Bowes MapXtreme User Manual

Page 208

Advertising
background image

Chapter 10: Creating Expressions

Expressions Overview

MapXtreme v7.1

215

Developer Guide

Expressions Overview

Expressions are statements that are used to describe and format data. For example, in English, an
expression might read like “a median income of more than $50,000, or “female percent of
population.”

Expressions are formed using column names, constants (i.e., specific data values), along with
functions and operators that act upon the columns and constants. The operators and functions are
defined in the MapInfo SQL Language, developed to support MapXtreme and other MapInfo .NET
supported products going forward. For details, see the MapInfo SQL Reference via the Help Viewer
in Visual Studio.

Use expressions to make the most of your data. By using expressions you can:

Show only the columns and rows of data that interest you.

Derive new columns by calculating new values based on the contents of your existing columns.

Aggregate data to work with subtotals instead of the entire table.

Combine data from two or more tables into one results table.

Many of the data sets you will use include more objects and information than necessary for your
projects. In many cases it is easier to work with a subset of the complete data product. For example,
if you were tracking crime statistics for a certain county by census tract, you would not need the
census tracts for the entire state. You would use an expression to extract just the census tracts for
the county.

Expressions are used throughout MapXtreme, in the following areas:

SQL statements (select, insert, update, delete, group by, order by)

SQL functions that take expressions as an arguments (e.g., the geometry argument in MI_Area()
is an expression that returns a geometry object.)

Adding columns (MapInfo.Data.Table.AddColumn creates a temporary column based on an
expression.)

Feature searches (SearchInfo and SearchInfoFactory)

Themes (FeatureStyleModifier)

Labels (LabelModifier)

InfoTips (FeatureLayer, MapTools)

Expression dialog

Creating Expressions

The simplest possible expression consists of a constant, such as “2” (numeric example) or “Friday”
(text example).

Other simple expressions consist of a column name, for example:

POP_2000
STATE

When you request specific multiple columns in a select statement, for example, these columns
together are known as an expression list.

Advertising