Datetime and time expressions, Expression examples – Pitney Bowes MapXtreme User Manual

Page 210

Advertising
background image

Chapter 10: Creating Expressions

Expression Examples

MapXtreme v7.1

217

Developer Guide

An example of using a function in an expression might be when you wish to look at the area of a
table of boundaries, such as school districts. Use the function MI_Area() to return the area of each
record in the table.

Additional examples of functions in expressions are found in the Expressions Examples section
below.

DateTIme and Time Expressions

When using DateTime and TIme expressions with MapXtreme, please be aware of the following:

If a DateTime column or Time column is used alone in an expression, it is formatted using the
current locale.

If a DateTime or Time column is in an expression, its string value is TimeToNumber or
DateToNumber + space + TimetoNumber.

Operator math on Time or DateTime is not supported. You can add a number to a Date, but not
to a Time or DateTime.

Expression Examples

The following highlights some uses of expressions in various areas of MapXtreme.

SQL Statement Examples

This example will select all records from the Eurcity_1K table that are within Germany and have a
population of over 1 million.

Select * from Eurcity_1K WHERE (MI_Geometry MI_Within @Germany) AND
Tot_Pop > 1000000

The following examples make selections based on Time and Date columns in the table. This
example will select all crime records from a "CrimeActivity" table where the crime occurred between
12:00:00 AM and 6:00:00 AM:

SELECT * FROM CrimeActivity WHERE CrimeTime BETWEEN '12:00:00 AM' AND
'6:00:00 AM'

Where CrimeTime is a Time column that stores the time at which the crime occurred.

This example will select employee Names from an "Employee" table who were born before
December 31, 1970.

SELECT Names FROM Employee WHERE BirthDay < '12/31/1970 12:00:00 AM'

Where BirthDay is a Date column that stores the birthdays of employees.

MapInfo SQL Function Example

The following expression uses a MapInfo SQL function to find features within a buffer.

Obj CentroidWithin MI_Buffer(Obj, 5, ‘km’, ‘Spherical’, 24)

Advertising