SQL Dialog - SQL Page

The SQL tab on the SQL dialog lets you build your SQL query.

A simplified version of the tab, without the spatial search settings, is displayed when editing SQL expressions for use in Themes.

ClosedShow me

If you are familiar with SQL queries, you can type in a query manually (using the Field Type and the Field boxes to insert the fields you need). Details of the SQL statements allowed in InfoAsset Manager can be found in the SQL Syntax topic. Details of time series expressions that can be used in an SQL query can be found in the Theory of Time Series Expressions topic.

Alternatively, click on the Builder >> button. This displays a set of buttons representing the operators that you can include in your query.

You can represent constant values in the query by typing the name of a user macro instead of a value. User macros are highlighted in blue.

For information on the dialog buttons, see SQL Dialog.

Field

Description

Object Type

Dropdown list of network objects

Field Type

 

Dropdown list of data fields applicable to network object selected in the Object Type box.

Selecting a Field Type from the list defines which fields will be available in the Field dropdown list :

  • <normal>: default. Will show fields related to the object type in the Field dropdown list.
  • flags: will show flag fields in the Field dropdown list. Flags for an object can be treated as an array, where the array contains two fields - value and name.
  • network: will show network id and name fields in the Field dropdown list which allow queries to be carried out across networks
  • individual join tables: will show joined table fields in the Field dropdown list.

Connected objects e.g. us_links and array fields e.g. cctv details are also available for selection.

Field

Dropdown list of data fields applicable to parameter selected in the Field Type box.

Selecting a Field from the list inserts the field in the query.

When Field Type is set to <normal>, fields related to the selected Object Type will be displayed.

In addition the following will be available:

  • oid (Object ID) - returns the primary key of the object. This can be used to get multi-part IDs for objects such as pipes that include link suffix as part of their ID.
  • otype (Object Type) - used to return the object type. Please click on the Example button below to reveal a couple of examples of how otype can be used in queries.
  • Closed

  • rank (Rank) - used to return the rank, (position), of the object as it appears in an ordered list. See SQL in InfoAsset Manager - Order by Clauses.
  • Closed

    Please note that an underscore is added to the field name for user defined fields belonging to user defined objects to distinguish them from built in fields. For example a user defined field called myfield will appear as myfield_ in the Field dropdown list.

Display Flag Fields check box

Check the Display Flag Fields box to include flag fields in the Field dropdown list.

Display precision

The Display precision dropdown box is only displayed when editing theme SQL expressions.

Select the number of decimal places to be shown when displaying the results of the SQL expression in labels.

Search Type

Dropdown list of available spatial search types for use with layers currently loaded in the GeoPlan.

The available options are:

Search Type

Description

Cross

Searches for network objects which intersect a layer line or polygon area

Inside

Layer Type

Description

ArcGIS Engine/

ArcGIS Desktop

GIS Layer

Searches for network objects completely inside a GIS layer polygon

MapXtreme GIS Layer

Searches for network objects with object centre inside a GIS layer polygon

Network / background network layer

Searches for network objects with object centre inside a network layer or background network layer polygon

Contains

Searches for network zones with objects completely inside the zone.

Distance

Searches for network objects within Distance of a layer line or polygon area

Layer Type

The Layer Type option becomes available when a spatial Search Type is selected.

Layer Type

Description

Network layer Object layer in the current network
Background layer

Network layer of network opened as a background network in the GeoPlan

GIS layer

Additional GIS background layer displayed behind the network in the GeoPlan

Spatial rain layer

The rainfall radar cells used in the simulation. This option is only available if the results of a simulation are opened on the GeoPlan.

Distance

The Distance option becomes available when Search Type Distance is selected.

Network objects within the specified Distance of a layer line or polygon area will be selected.

Layer

The Layer option becomes available when a spatial Search Type is selected.

Dropdown list of layers currently loaded in the GeoPlan (only those layers loaded in the GeoPlan Window before the SQL dialog is opened will be listed).

Field

The Field option becomes available when a spatial Search Type is selected.

Dropdown list of fields within the Layer selected in the Layer box.

Selecting a spatial search Field from the list inserts the field in the query.

Builder

Click the Builder >> button to display a set of buttons representing the operators that can be included in the query. Click the Finish << button to close the builder.

SQL Syntax

SQL - User Macros Page

SQL - Grid Page

Theory of Time Series Expressions