Query Toolbar

The Query toolbar provides fast selection in tables, drawings and drawing layers in maps using "one line" simple queries using data fields associated with objects.

 

images\tbar_query.gif

 

Field box Operator box Value box

 

The Query toolbar consists of three boxes, from left to right: a field box, the operator box, and a value box. The example show selects all records where Place_name contains the string "DURANGO".

 

Field box

Also known as the column box. The field that will be queried. The illustration above shows that the Place_name field will be queried. The field box will show all fields available in the table, including intrinsic fields and any fields brought in via relations .

Operator box

The query operator to use. Press in the not button to the left of the operator box to use the "not" version of the operator. For example, pressing in the not button in the example above will find all records Not Equal to the given value.

Value box

The value to be used with the operator. Not all operators require values. For example, Median does not take a value in the value box.

 

We use dark blue, black, and violet bold face fonts in this topic to distinguish the three boxes to make examples and explanation more clear. In "real life," Manifold uses the same black font color in all three Query toolbar boxes.

 

To find objects or records using the query toolbar:

 

1. Open the drawing, table or map. If using a map, click on the drawing layer desired.

2. Choose the field to query in the field box.

3. Choose an operator in the operator box. Push in the not button if the "not" form of an operator is desired.

4. Provide a value in the operator box if one is required for the operator used.

5. Press Select.

 

All objects in a drawing or records in a table selected by the query will appear in red selection color.

 

Query Toolbar Operators

 

Operators are available depending upon the type of table column selected. For example, operators using tokens work only with text columns. Comparison operators such as Greater than will work with text, binary, coordinate system and geometry columns as well as with numeric columns. When used with non-numeric columns a comparison operator will compare data going byte-by-byte stopping on the first different pair of bytes.

 

Binary columns, coordinate system columns and geometry columns support Duplicates, Duplicates Except First, Equal To, Greater Or Equal To, Greater Than, Less Or Equal To, Less Than, Not Equal To, and Uniques operators.

 

Areas

Select records with geometry for area objects. Available for geometry columns.

Bottom

Find the lowest N values of the given field. For example, Bottom 5 will find records with the lowest five values of the given field.

Containing

Select records in which the given field contains the given string.

Containing Match

Select records in which the given field contains the given regular expression.

Containing Token

Select records in which the given field contains the given token. See the Transform - Using Tokens and Text Strings topic for information on tokens.

Duplicates

Select records that contain duplicate values in the given field.

Duplicates Except First

Select records that contain duplicate values in the given field, excluding the first record of each set of duplicates.

Empty

Select records with empty values. Available for binary, coordinate system, geometry, text and URL columns.

Ending with

Select records in which the given field ends in the given string.

Ending with Match

Select records in which the given field ends in the given regular expression.

Ending with Token

Select records in which the given field ends in the given token.

Equal to

Select records in which the given field is equal to the given value.

Greater than

Select records in which the given field is greater than the given value.

Greater or Equal to

Select records in which the given field is greater than or equal to the given value.

Less than

Select records in which the given field is less than the given value.

Less or Equal to

Select records in which the given field is less than or equal to the given value.

Lines

Select records with geometry for line objects. Available for geometry columns.

Matching

Select records in which the given field matches the given regular expression.

Maximum

Select records in which the given field is the maximum value of all values found in the table.

Median

Select records in which the given field is the median value of all values found in the table.

Minimum

Select records in which the given field is the minimum value of all values found in the table.

Not Equal to

Select records in which the given field is not equal to the given value. Equivalent to pressing the not button and using Equal to

Points

Select records with geometry for point objects. Available for geometry columns.

Sounding Like

Find records with strings that have similar pronunciation in English using the Soundex algorithm. For example, in the Mexico_eg.mif sample drawing selecting Place_name Sounding Like doorangoh will find the province of Durango.

Starting with

Select records in which the given field starts with the given string.

Starting with Match

Select records in which the given field starts with the given regular expression.

Starting with Token

Select records in which the given field starts with the given token.

Top

Find the highest N values of the given field. For example, Top 5 will find records with the highest five values of the given field.

Typical

Find records in which the value of the given field is within the given number of records of the median.

Uniques

Select all records for which the value of the given field is not duplicated in other records. Equivalent to using not with the Duplicates operator.

 

Examples

 

The following examples are based on the mexico_eg.mif sample drawing.

 

Place_name Sounding Like doorangoh will select the province of Durango.

 

Area(I) Top 5 will select the 5 largest areas.

 

Place_name Duplicates selects all area objects that have duplicate names. For example, there are three objects with a Place_name of CAMPECHE and two that are named SONORA. This is a fast way of finding area objects, such as provinces, that may be drawing using more than one area. This is typically done to show islands or other non-contiguous parts of a province, country, state or county.

 

Regular Expression Examples

 

The Matching, Containing Match, Ending with Match and Starting with Match operators use Visual Basic style regular expressions. Examples using mexico_eg.mif and the Place_name field would be:

 

Matching DURANGO selects one record ("DURANGO"),

Matching CHI.+ selects two records ("CHIHUAHUA" and "CHIAPAS"),

Matching .+OR[AE].* selects three records ("SONORA", "SONORA" and "MORELOS"),

Containing Match C[PQR] selects one record ("VERACRUZ"),

Containing Match [^ A-Z] selects one record ("EDO. DE MEXICO"),

Starting With Match BA.+ selects four records (all starting with "BAJA"),

Starting With Match BB.+ selects nothing,

Starting With Match [F-H] selects three records ("HIDALGO", "GUANAJUATO" and "GUERRERO"),

Ending With Match " ..." (a space followed by three periods without quotation marks) selects three records ("BAJA CALIFORNIA SUR", "QUINTANA ROO" and another "QUINTANA ROO").

 

Token Operator Examples

 

Operators such as Containing, Ending with or Starting with Token use "tokens" which are groups of characters set off by separator characters. Tools - Options allows specifying what characters should be considered to be separators.

 

Suppose we have a field in a table listing the following set of processors:

 

AMD K6

AMD Athlon

Intel 486

Intel 486SX

Intel Pentium

Intel PII

Intel PIII

 

Examples of different operators and results would be:

 

Containing Token PII selects "Intel PII".

Containing PII selects "Intel PII" and "Intel PIII".

Containing Token 486 selects "Intel 486".

Containing 486 selects "Intel 486" and "Intel 486SX".

 

Tech Tip

 

Suppose we would like to select all records with a null value in a given field. That is, we want to find all records that don't have a value in that field. There are at least five methods of doing so using the query toolbar. In the examples that follow below, do not type the " quotation marks in the value box. The field Name will be searched and all records with non-empty values in Name will be selected.

 

Use a regular expression requiring non-empty text:

 

 Name Matching ".+" (period and plus sign in the value box)

 

Use a regular expression with the NOT button:

 

 Name Not Matching ".*" (period and asterisk in the value box)

 

A hack using the Sounding Like operator:

 

 Name Sounding Like "" (nothing in the value box)

 

A hack using the Less Than operator:

 

Name Sounding Like " " (space character in the value box)

 

An elegant use of the Minimum operator:

 

 Name Minimum

 

Themes and Toolbars

 

Themes can be used in the query and Transform toolbars. Object sets defined on themes will always use the name of the theme's parent drawing. For example, if there are selected objects in a theme named T whose parent is a drawing named D the selection choice will appear in the query or transform toolbar boxes as Selection in D.

 

This is done so that it is immediately clear that modifying a theme will modify the parent drawing (and thus all other themes bound to that drawing).

 

See also

 

The transform toolbar is also used to make spatial selections using commands such as Select Touching or Select Contained within that work between sets of objects.