• InfoWorks WS Pro

Updating data using SQLs

Update network data using an SQL query.


Tutorial resources

These downloadable resources will be used to complete this tutorial:

iwsp2023M20U03_SQL_Updtng_Dta.wspt

Step-by-step guide

In InfoWorks WS Pro, SQLs can be used to update network data of selected objects. In this exercise, you use SQL to first update the friction factor of pipes made of MDPE, and then a second time to populate a user text field.

  1. From the Model Group, expand the SQL Model group.
  2. Double-clicking the SQL Network to open the SQL Network and SQL Control on the GeoPlan.
  3. Right-click Stored Query Group.
  4. Select New > Stored Query.

In the Model Group, Stored Query shortcut menu, New>Stored Query are selected.

  1. In the popup, type the Name “MDPE FF”.
  2. Click OK.
  3. In the Model Group, double-click the MDPE FF stored query object.
  4. In the Stored Query window, from the Object Type drop down, select Pipe.
  5. In the query window, on the first line, type: SELECT FROM Pipe WHERE material = "MDPE";
  6. On the second line, type: SET k = 0.1
  7. Click the Test button.

In the SQL dialog box, the text box with the SQL query entered.

A pop-up appears indicating valid syntax.

  1. Click OK.
  2. Click Save to save the SQL.
  3. Click Run.

The SQL dialog box with the MDPE > 20 selection query entered and Run selected.

The SQL window closes, and the MDPE pipes are now selected in the GeoPlan.

  1. On the Tools toolbar, click the Properties tool.

On the Tools toolbar, the Properties tool is selected and called out, and on the GeoPlan, the MDPE pipes are selected.

  1. On the GeoPlan, select any of the highlighted pipes.

In the Properties window, notice the CW - k (mm) value changes to 0.1.

  1. Commit the changes to the database.

To create the second stored query:

  1. Right-click the Stored Query Group.
  2. Select New > Stored Query.
  3. In the popup, type the Name “User Text 1”.
  4. Click OK.
  5. In the Model Group, double-click User Text 1.
  6. In the Stored Query window, in the Object Type drop-down, select Customer Point.
  7. In the query window type: SET user_text_1 = "Significant Dom User" WHERE spec_consumption > 500
  8. Click Test.
  9. Click OK to close the notification.
  10. Click Save.
  11. Click Run.

The SQL dialog box with the MDPE > 20 selection query entered and Run selected.

  1. Once the SQL has completed, in the Windows toolbar, expand the Grid windows drop-down.
  2. Select New customer points window.
  3. Scroll to the User Text 1 column.

Note that some customers are now specified as Significant Users.

In the SQL Network dialog, the User Text 1 column is highlighted and displays the Significant Users.

  1. Commit the changes to the database.