• InfoWorks WS Pro

Working with SQL

Use SQL in order to query model data and set properties of a network and control.


Tutorial resources

These downloadable resources will be used to complete this tutorial:

iwsp2023M04U06_Working_with_SQL.wspt

Step-by-step Guide

Structured Query Language, or SQL, allows you to query model data, like nodes and links in a network and control, simulation results that are open, and GIS background layers. SQL queries can also set properties of a network and control. You can use these queries to select objects in a GeoPlan, display a table of results, or save results to a CSV. They can also be used to aggregate timeseries data, such as simulation results.

  1. Open the appropriate data set.
  2. In the Model Group window, under Session 04, drag-and-drop the BridgeNet network into the workspace to open it in the GeoPlan.
  3. Drag-and-drop [Resize-63] BridgeCon into the GeoPlan.
  4. Expand Selection Lists.
  5. Drag-and-drop Pipe Selection into the GeoPlan.

Notice that three pipes are now highlighted in red.

In the InfoWater WS Pro interface, the Model Group window with the network, a run, and a selection list highlighted in red; and in the GeoPlan, three pipes highlighted in red.

  1. In the Model Group window, expand Stored Query Group.
  2. Double-click Pipe Aggregate.

The Model Group window with Stored Query Group expanded and Pipe Aggregate selected and called out.

  1. In the SQL: Pipe Aggregate dialog box, review the list of formulas that will calculate the length, diameter, flow, head loss, and velocity of the pipes selected in the GeoPlan.
  2. Enable Apply Filter to Current Selection.
  3. Click Test.
  4. In the notification dialog box, click OK.
  5. Click Run.

The SQL: Pipe Aggregate dialog box with a list of formulas that will calculate details, such as average diameter and flow, for the pipes selected in the GeoPlan.

  1. In the grid window, review the average length, diameter, flow, head loss, and velocity of the selected pipes.

The grid window with results from the query, such as length and average diameter of the selected pipes.

  1. Minimize the grid.
  2. In the workspace, Close the GeoPlan.
  3. Click Yes to confirm that you want to close all windows associated with the network.

Note: When using SQLs on other scenarios, remember, you must give them a selection of objects to work with, or it will not return any results.