SelectByQueryFile()

Summary

Selects records based on an SQL query that is stored in a file.

Changes

Optional options array introduced in Version 5.0.

Syntax

n_selected = SelectByQueryFile(string set_name, string operation, string query_file [, array options])

Argument Contents
set_name The name of the selection set
operation The operation to perform, as indicated below
query_file The path and name of the file that contains the SQL query
Operation Meaning
Several Replaces the contents of the selection set
Less Removes features from the selection set
More Adds features to the selection set
Subset Selects a subset of the selection set
Option Type Contents
Index Limit Integer The number of records above which a temporary index will not be built. The default behavior of SelectByQuery() is to build an index if it determines that the index will speed up the query. The "Index Limit" option can prevent this by using a value of 0
Inclusion String "Enclosed" or "Intersecting", overriding the current setting; for more information, see SetSelectInclusion()
Max Integer Maximum number of records to select
Display Boolean "True" or "False" overriding the current setting; for more information, see SetSelectDisplay()
Auto Redraw Boolean "True" or "False" overriding the current setting; for more information, see SetSelectAutoRedraw()
Source And String A selection set on the current layer that records must be in to be selected
Source Not String A selection set on the current layer that records must not be in to be selected

Returns

An integer indicating the number of records in the selection set.

Notes

  • The options array is an optional argument.

  • All selection commands operate on the current layer.

  • If the set does not already exist, it is created.

  • Queries must be of the form "Select * where condition", where condition is a valid expression as described in "Formulas, Conditions, and Functions" in the Maptitude Help.

Example

n = SelectByQueryFile("High Income", "Several", "c:\\qry1.txt",)

Error Codes

Error Type Meaning
Error The set name, operation type, or query string is invalid
NotFound The query file does not exist or no features match the query

See Also

Function Summary
SelectByQuery() Selects records based on an SQL query