Build and run an SQL query in InfoAsset Manager

Build and run queries to select or update network objects.


Build and run an SQL query in InfoAsset Manager

Step-by-step guide

In InfoAsset Manager, SQL (Structured Query Language) is used for selecting and updating network objects using specified criteria.

An SQL query consists of clauses, separated by semi-colons. Each clause can do one of the following:

  • Select objects
  • Deselect objects
  • Update fields in objects
  • Clear the selection

These operations are built with syntax keywords, such as SELECT, COUNT, SET, CLEAR, DELETE, UPDATE, and DESELECT.

Queries are built in the SQL dialog.

To build a query:

  1. Open the network on the GeoPlan.
  2. From the Selection toolbar, click SQL Select.
    The top-left corner of the InfoAsset Manager interface, with the SQL Select tool highlighted as being selected.
  3. Set the Object Type to Pipe.

TIP: Since this is a long drop-down, type P to quickly jump to that point in the alphabetical list.

  1. In the text box, type SET and add a space after it.
  2. In the Field drop-down, select user_number_10.
    The SQL dialog, with the Object Type already set to Pipe and the Field drop-down expanded, with the desired field highlighted as being selected.

The query text should now be:

SET user_number_10

Next, make the set field equal to the survey length from the CCTV Survey table. Use the query builder to help construct the rest of the query.

  1. Click Builder to display a set of buttons that represent the operators that can be included in the query.
    The SQL dialog, with the Builder button highlighted for selection.
  2. In the Comparison group, click the equals (=) sign.
    The SQL dialog with the expanded Builder tools showing, and the equals tool being selected in the Comparison group.
  3. To select the fields from associated CCTV Surveys, in the Field Type drop-down, select cctv_surveys.
  4. From the Field drop-down, select surveyed_length.

The query is complete and should be set as the following:

SET user_number_10 = cctv_surveys.surveyed_length

  1. Click Test.
  2. In the message popup, click OK.
    The SQL dialog in the background, with a popup message stating that the query has valid syntax after the Test button was clicked.

To save the query for later use, if needed:

  1. Click Save As.
    The SQL dialog with the Save As button highlighted and the Save As dialog displayed.

To run the query:

  1. Click Run.
    The expanded SQL dialog with the completed query and the Run button highlighted.

To see the results of the query:

  1. Open the property sheet for a pipe in the network.
  2. Under User defined properties, note the value in the User number 10 field.
    The Properties panel and GeoPlan showing the selected pipe and its queried property highlighted.

Another SQL query that can be built and run is to set the street field of the node based on the Manhole Survey, where it is not currently set on the asset:

SET street = manhole_surveys.street WHERE street = NULL

Or, build a similar query for pipes from CCTV Surveys:

SET location = cctv_surveys.road_name WHERE location = NULL

TIP: Run various queries across multiple tables together. Combine queries with a semi-colon at the end of each query syntax.

TIP: Add comments or ignore lines of syntax by adding two backslashes (\\) at the beginning of a line. Everything on the same line after the backslashes will be displayed in green and ignored when running the query.

The SQL dialog with all sample queries from this example typed in the text box and highlighted.