beautypg.com

Constructing complex expressions – Pitney Bowes MapInfo Professional User Manual

Page 439

background image

Filter criteria can use any column in your base table(s), regardless of whether you included the column
in the Select Columns field.

Columns can be referred to by name or by number, where the number designates the order the column
has in Select Columns. Thus, "col1" and "col6" refer to the first and sixth columns, respectively. The
number must be preceded by the letters "col".

• For more instructions and related topics, see the Using Expressions to Create a New Column topic in

the Help System.

Constructing Complex Expressions

Now consider examples 9 and 10, that are a bit more complex than 1 through 8:

1. POP_1990 > POP_1980*1.2

2. round((POP_1980*1.2)/TOTAL_AREA,.1)

We created expression 9 by taking expression 3 and replacing the constant "17893" with the whole of
expression 6. Similarly, we created expression 10 by taking expression 8 and replacing "POP_1990"
with expression 6.

In general, you create complex expressions by combining simple expressions. Perhaps the best way to
learn how to do this is look at some of the examples we have provided (above and following) and create
your own expressions based on those examples. However, there are two very general techniques for
creating complex expressions.

• Replace a column name or a specific value with a simple expression.

• Combine expressions using logical operators (and, not, or).

Example six illustrates the first technique. There are many examples of the second technique throughout
this entry. See particularly the discussion following

Using Logical Operators in Expressions

.

Entering Specific Values (Constants) into Expressions

Use the Expression dialog box to formulate mathematical and alphanumeric expressions in several
MapInfo Professional dialog boxes.

When entering specific character strings, numbers, and dates into expressions, you need to observe
the following conventions.

Character Strings in Expressions

When typing a particular string into an expression you must enclose it in double quotes. MapInfo
Professional then treats it as a string rather than as a column name. For example, strings 1 and 2 shown
below are valid string constants, while 3 and 4 are not.

1. "Orange"

2. "New York"

3. Orange

4. New York

Numbers in Expressions

When entering specific numerical values, do not use commas, dollar signs, or any characters other than
numerals, decimal points, and the minus sign for negative numbers. You can use E to denote numbers
in exponentiation.

Date Values in Expressions

Dates consist of a month, a day, and an optional year. The year is specified by two or four digits and
enclosed in double quotes. The components of a date are separated by hyphens or slashes. If the year
is not specified, it defaults to the year set on your computer's clock. The following are valid data constants:

439

MapInfo Professional User Guide

Chapter 17: Specialized Topics in MapInfo Professional