Maptitude GISDK Help

SelectByQuery()

Summary

Selects records based on an SQL query.

 

Changes

Optional options array introduced in Version 5.0. Show Progress Bar option added in Version 2017.

 

Syntax

n_selected = SelectByQuery (string set_name, string operation, string query [, array options])

 

Argument

Contents

set_name

The name of the selection set

operation

The operation to perform, as indicated below

query

The SQL query string

 

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

Show Progress Bar

Boolean

"True" to show the progress bar, otherwise "False"

 

Returns

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

 

Notes

Examples

qry1 = "Select * where Income > 50000"

qry2 = 'Select * where Category = "Retail" '

n1 = SelectByQuery("High Income", "Several", qry1,)

n2 = SelectByQuery("Retail Stores", "Several", qry2, {{"Index Limit", 0}})

 

Error Codes

Error Type

Meaning

Error

The set name, operation type, or query string is invalid, or the view has not been set

NotFound

The value being checked for doesn't exist

 

See Also

Function

Summary

SelectByQueryFile()

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

 

 

©2025 Caliper Corporation www.caliper.com