Download MapInfo Professional User Guide

Transcript
Chapter 16: Specialized Topics in MapInfo Professional
Working with the MapBasic Window
Now consider expression 60, which is intended to select all records July or September of 1989.
1. year(RECEIVED)=89 and month(RECEIVED)=7 or month(RECEIVED)=9
Because “and” has higher precedence than “or”, MapInfo Professional treats this expression as
though “year(RECEIVED)=89 and month(RECEIVED)=7” was enclosed in parentheses.
1. (year(RECEIVED)=89 and month(RECEIVED)=7) or month(RECEIVED)=9
In this case, any record for July of 89 or for September of any year would be selected. That’s
probably not what you want. However, by adding parentheses to the second expression, you can get
this:
1. year(RECEIVED)=89 and (month(RECEIVED)=7 or month(RECEIVED)=9)
In this expression, the parentheses tell MapInfo Professional that “month(RECEIVED)=7” and
“month(RECEIVED)=9” are alternatives in the second clause of the expression. MapInfo
Professional treats this the same as it treats number 53 above.
L
When you are not sure how MapInfo Professional evaluates an expression with several
operators, you should use parentheses to group elements as you want them.
Using Functions in Expressions
Functions take data values and perform some operation on them to produce a new value. Functions
have the following form:
SomeFunction(parameters)
Most of MapInfo Professional’s functions take one or two parameters. A parameter can be a column
or another expression. MapInfo Professional uses the keyword “obj” or “object” with the geographic
functions: Area, CentroidX, CentroidY, ObjectLen, and Perimeter. This keyword tells MapInfo
Professional that it has to get values based on graphical objects in the table rather than tabular data.
•
For more information about specific functions, see the Help System.
Working with the MapBasic Window
This section allows advanced MapInfo Professional users to go behind the scenes and take
advantage of functions that enhance the use of MapInfo Professional through the MapBasic window.
MapBasic is MapInfo Professional’s programming language that allows you to customize and
automate MapInfo Professional functionality. When MapBasic was created, the MapBasic Window
feature was added to MapInfo Professional as a means of testing and debugging code for an
application. It became apparent that the MapBasic window is also a useful tool to MapInfo
Professional users for doing certain tasks such as complex selections and queries based on object
information.
MapInfo Professional 11.0
440
User Guide