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:
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.
- Open the appropriate data set.
- In the Model Group window, under Session 04, drag-and-drop the BridgeNet network into the workspace to open it in the GeoPlan.
- Drag-and-drop [Resize-63] BridgeCon into the GeoPlan.
- Expand Selection Lists.
- Drag-and-drop Pipe Selection into the GeoPlan.
Notice that three pipes are now highlighted in red.
- In the Model Group window, expand Stored Query Group.
- Double-click Pipe Aggregate.
- 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.
- Enable Apply Filter to Current Selection.
- Click Test.
- In the notification dialog box, click OK.
- Click Run.
- In the grid window, review the average length, diameter, flow, head loss, and velocity of the selected pipes.
- Minimize the grid.
- In the workspace, Close the GeoPlan.
- 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.