<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data</link><pubDate>Fri, 26 Aug 2022 16:15:13 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Jesse Dringoli</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Current Revision posted to OpenFlows | Water Infrastructure Wiki by Jesse Dringoli on 8/26/2022 4:15:13 PM&lt;br /&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;V8i, CONNECT Edition&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is available in the first step of ModelBuilder when importing external data. It uses standard SQL syntax&amp;nbsp;to enable you&amp;nbsp;to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import pipes of a certain material, or only a subset of valve types (in a case where a single valve feature represents multiple types of valves with a field differentiating them.)&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " border="0" src="/photos/akshayas_images/images/56069/original.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies to the layer that you select on the left side, and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;If the field name has spaces, use brackets around it. For example: &lt;em&gt;&lt;strong&gt;[internal diameter] = 16&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;If you want to import multiple specific elements (from a list), you can use the OR operator but it is suggested that you use a text or whole number field. For example trying to import polylines with a specific shape length may not work well because&amp;nbsp;&lt;span&gt;floating point numbers that go out to many decimal places can&amp;nbsp;be very difficult to match exactly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot; or &lt;a href="https://docs.bentley.com/LiveContent/web/Bentley%20WaterCAD%20CONNECT%20Edition%20Help-v1/en/GUID-57FF6E0A-A271-4040-85AB-27830321D989.html"&gt;online documentation&lt;/a&gt; for SQL syntax.&lt;/p&gt;
&lt;p&gt;Here is an example of using the LIKE operator for a &amp;quot;ValveType&amp;quot; field which contains various codes for different valve types such as &amp;#39;PRV12345&amp;#39;: &lt;strong&gt;ValveType LIKE &amp;#39;PRV%&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Subtypes&lt;/strong&gt;: some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spaces in column names&lt;/strong&gt; - if you want to use the WHERE clause on a column whose name has a space, use brackets. For example [In Model] or [Year Installed].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NULLs&lt;/strong&gt;: If you want to filter the data source to rows where the value in a specific column is null (blank), use the syntax IS NULL. For example if you have a column called &amp;quot;In Model&amp;quot; and you want to only import the data from that table where there is no value in that column (it is blank/null), then use the WHERE clause&lt;strong&gt; [In Model] IS NULL&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Duplicating Tables&lt;/h2&gt;
&lt;p&gt;The duplicate option (button) in the first ModelBuilder step (to the left of the WHERE clause) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them). Later in in the ModelBuilder steps, you can then specify the respective different element types for the different duplicated tables.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img alt=" " src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, Reviewed2018, ModelBuilder, Filter, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/7</link><pubDate>Mon, 01 Mar 2021 17:28:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Jesse Dringoli</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 7 posted to OpenFlows | Water Infrastructure Wiki by Jesse Dringoli on 3/1/2021 5:28:09 PM&lt;br /&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;V8i, CONNECT Edition&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is available in the first step of ModelBuilder when importing external data. It uses standard SQL syntax&amp;nbsp;to enable you&amp;nbsp;to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import pipes of a certain material, or only a subset of valve types (in a case where a single valve feature represents multiple types of valves with a field differentiating them.)&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " border="0" src="/photos/akshayas_images/images/56069/original.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies to the layer that you select on the left side, and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;If the field name has spaces, use brackets around it. For example: &lt;em&gt;&lt;strong&gt;[internal diameter] = 16&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot; or &lt;a href="https://docs.bentley.com/LiveContent/web/Bentley%20WaterCAD%20CONNECT%20Edition%20Help-v1/en/GUID-57FF6E0A-A271-4040-85AB-27830321D989.html"&gt;online documentation&lt;/a&gt; for SQL syntax.&lt;/p&gt;
&lt;p&gt;Here is an example of using the LIKE operator for a &amp;quot;ValveType&amp;quot; field which contains various codes for different valve types such as &amp;#39;PRV12345&amp;#39;: &lt;strong&gt;ValveType LIKE &amp;#39;PRV%&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Subtypes&lt;/strong&gt;: some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spaces in column names&lt;/strong&gt; - if you want to use the WHERE clause on a column whose name has a space, use brackets. For example [In Model] or [Year Installed].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NULLs&lt;/strong&gt;: If you want to filter the data source to rows where the value in a specific column is null (blank), use the syntax IS NULL. For example if you have a column called &amp;quot;In Model&amp;quot; and you want to only import the data from that table where there is no value in that column (it is blank/null), then use the WHERE clause&lt;strong&gt; [In Model] IS NULL&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Duplicating Tables&lt;/h2&gt;
&lt;p&gt;The duplicate option (button) in the first ModelBuilder step (to the left of the WHERE clause) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them). Later in in the ModelBuilder steps, you can then specify the respective different element types for the different duplicated tables.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img alt=" " src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, Reviewed2018, ModelBuilder, Filter, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/6</link><pubDate>Tue, 04 Aug 2020 04:14:32 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Yashodhan Joshi</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 6 posted to OpenFlows | Water Infrastructure Wiki by Yashodhan Joshi on 8/4/2020 4:14:32 AM&lt;br /&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;V8i, CONNECT Edition&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is available in the first step of ModelBuilder when importing external data. It uses standard SQL syntax&amp;nbsp;to enable you&amp;nbsp;to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import pipes of a certain material, or only a subset of valve types (in a case where a single valve feature represents multiple types of valves with a field differentiating them.)&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " border="0" src="/photos/akshayas_images/images/56069/original.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies to the layer that you select on the left side, and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot; or &lt;a href="https://docs.bentley.com/LiveContent/web/Bentley%20WaterCAD%20CONNECT%20Edition%20Help-v1/en/GUID-57FF6E0A-A271-4040-85AB-27830321D989.html"&gt;online documentation&lt;/a&gt; for SQL syntax.&lt;/p&gt;
&lt;p&gt;Here is an example of using the LIKE operator for a &amp;quot;ValveType&amp;quot; field which contains various codes for different valve types such as &amp;#39;PRV12345&amp;#39;: &lt;strong&gt;ValveType LIKE &amp;#39;PRV%&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Subtypes&lt;/strong&gt;: some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spaces in column names&lt;/strong&gt; - if you want to use the WHERE clause on a column whose name has a space, use brackets. For example [In Model] or [Year Installed].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NULLs&lt;/strong&gt;: If you want to filter the data source to rows where the value in a specific column is null (blank), use the syntax IS NULL. For example if you have a column called &amp;quot;In Model&amp;quot; and you want to only import the data from that table where there is no value in that column (it is blank/null), then use the WHERE clause&lt;strong&gt; [In Model] IS NULL&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Duplicating Tables&lt;/h2&gt;
&lt;p&gt;The duplicate option (button) in the first ModelBuilder step (to the left of the WHERE clause) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them). Later in in the ModelBuilder steps, you can then specify the respective different element types for the different duplicated tables.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img alt=" " src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, Reviewed2018, ModelBuilder, Filter, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/5</link><pubDate>Tue, 04 Aug 2020 04:13:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Yashodhan Joshi</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 5 posted to OpenFlows | Water Infrastructure Wiki by Yashodhan Joshi on 8/4/2020 4:13:43 AM&lt;br /&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;V8i, CONNECT Edition&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is available in the first step of ModelBuilder when importing external data. It uses standard SQL syntax&amp;nbsp;to enable you&amp;nbsp;to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import pipes of a certain material, or only a subset of valve types (in a case where a single valve feature represents multiple types of valves with a field differentiating them.)&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " border="0" src="/photos/akshayas_images/images/56069/original.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies to the layer that you select on the left side, and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;&lt;a href="https://docs.bentley.com/LiveContent/web/Bentley%20WaterCAD%20CONNECT%20Edition%20Help-v1/en/GUID-57FF6E0A-A271-4040-85AB-27830321D989.html"&gt;Specifying a SQL WHERE clause in ModelBuilder&lt;/a&gt;&amp;quot; or online documentation for SQL syntax.&lt;/p&gt;
&lt;p&gt;Here is an example of using the LIKE operator for a &amp;quot;ValveType&amp;quot; field which contains various codes for different valve types such as &amp;#39;PRV12345&amp;#39;: &lt;strong&gt;ValveType LIKE &amp;#39;PRV%&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Subtypes&lt;/strong&gt;: some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spaces in column names&lt;/strong&gt; - if you want to use the WHERE clause on a column whose name has a space, use brackets. For example [In Model] or [Year Installed].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NULLs&lt;/strong&gt;: If you want to filter the data source to rows where the value in a specific column is null (blank), use the syntax IS NULL. For example if you have a column called &amp;quot;In Model&amp;quot; and you want to only import the data from that table where there is no value in that column (it is blank/null), then use the WHERE clause&lt;strong&gt; [In Model] IS NULL&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Duplicating Tables&lt;/h2&gt;
&lt;p&gt;The duplicate option (button) in the first ModelBuilder step (to the left of the WHERE clause) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them). Later in in the ModelBuilder steps, you can then specify the respective different element types for the different duplicated tables.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img alt=" " src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, Reviewed2018, ModelBuilder, Filter, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/4</link><pubDate>Tue, 29 Oct 2019 14:44:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Jesse Dringoli</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 4 posted to OpenFlows | Water Infrastructure Wiki by Jesse Dringoli on 10/29/2019 2:44:37 PM&lt;br /&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;V8i, CONNECT Edition&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is available in the first step of ModelBuilder when importing external data. It uses standard SQL syntax&amp;nbsp;to enable you&amp;nbsp;to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import pipes of a certain material, or only a subset of valve types (in a case where a single valve feature represents multiple types of valves with a field differentiating them.)&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " border="0" src="/photos/akshayas_images/images/56069/original.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies to the layer that you select on the left side, and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot; or online documentation for SQL syntax.&lt;/p&gt;
&lt;p&gt;Here is an example of using the LIKE operator for a &amp;quot;ValveType&amp;quot; field which contains various codes for different valve types such as &amp;#39;PRV12345&amp;#39;: &lt;strong&gt;ValveType LIKE &amp;#39;PRV%&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Subtypes&lt;/strong&gt;: some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spaces in column names&lt;/strong&gt; - if you want to use the WHERE clause on a column whose name has a space, use brackets. For example [In Model] or [Year Installed].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NULLs&lt;/strong&gt;: If you want to filter the data source to rows where the value in a specific column is null (blank), use the syntax IS NULL. For example if you have a column called &amp;quot;In Model&amp;quot; and you want to only import the data from that table where there is no value in that column (it is blank/null), then use the WHERE clause&lt;strong&gt; [In Model] IS NULL&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Duplicating Tables&lt;/h2&gt;
&lt;p&gt;The duplicate option (button) in the first ModelBuilder step (to the left of the WHERE clause) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them). Later in in the ModelBuilder steps, you can then specify the respective different element types for the different duplicated tables.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img alt=" " src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, Reviewed2018, ModelBuilder, Filter, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>Using the WHERE clause and Duplicate option in ModelBuilder to filter imported data</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/3</link><pubDate>Tue, 23 Oct 2018 15:15:03 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Jesse Dringoli</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 3 posted to OpenFlows | Water Infrastructure Wiki by Jesse Dringoli on 10/23/2018 3:15:03 PM&lt;br /&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;V8i, CONNECT Edition&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is available in the first step of ModelBuilder when importing external data. It uses standard SQL syntax&amp;nbsp;to enable you&amp;nbsp;to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import pipes of a certain material, or only a subset of valve types (in a case where a single valve feature represents multiple types of valves with a field differentiating them.)&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " border="0" src="/photos/akshayas_images/images/56069/original.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies only for selected layer (in this case, &amp;quot;PIPE []&amp;quot;), and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot;.&lt;/p&gt;
&lt;p&gt;Here is an example of using the LIKE operator for a &amp;quot;ValveType&amp;quot; field which contains various codes for different valve types such as &amp;#39;PRV12345&amp;#39;: &lt;strong&gt;ValveType LIKE &amp;#39;PRV%&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;Some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Duplicating Tables&lt;/h2&gt;
&lt;p&gt;The duplicate option (button) in the first ModelBuilder step (to the left of the WHERE clause) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them). Later in in the ModelBuilder steps, you can then specify the respective different element types for the different duplicated tables.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img alt=" " src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, Reviewed2018, ModelBuilder, Filter, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>Using the WHERE clause and Duplicate option in ModelBuilder</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/2</link><pubDate>Wed, 08 Feb 2017 16:40:58 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Jesse Dringoli</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 2 posted to OpenFlows | Water Infrastructure Wiki by Jesse Dringoli on 2/8/2017 4:40:58 PM&lt;br /&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;table align="left" style="border:0px solid #dce5f0;background-color:#dce5f0;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.xx.xx&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Using the WHERE Clause&lt;/h1&gt;
&lt;p&gt;The WHERE clause is SQL syntax that allows a user to filter the data in a particular table in the source file before importing into a model. As an example, you could use this if you only wanted to import a certain pipe material.&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE clause box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/photos/akshayas_images/images/56069/original.aspx" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; clause applies only for selected layer (in this case, &amp;quot;PIPE []&amp;quot;), and different &amp;quot;WHERE&amp;quot; clauses can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE clause is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE clause will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE clause and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;Some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Duplicating Tables&lt;/h3&gt;
&lt;p&gt;The duplicate option (button) is often used in conjunction with the WHERE clause. This can be especially useful if you have a single table in the data source that spans multiple element types. For example a &amp;quot;valves&amp;quot; table that includes rows for PRVs, PSVs and FCVs in WaterCAD or WaterGEMS. These are different node types in WaterCAD and WaterGEMS and a particular table can only be mapped to one. So, you could use the duplicate button to include this table three times, and use a separate WHERE clause in each one to filter it only to the respective node type (assuming there is something that distinguishes them).&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-32/6574.Duplicate.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: HAMMER, StormCAD, SewerGEMS, reviewed2017, SewerCAD, ModelBuilder, Duplicate, WaterGEMS, CivilStorm, SQL, WaterCAD, WHERE&lt;/div&gt;
</description></item><item><title>General steps for using the WHERE statement in ModelBuilder</title><link>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data/revision/1</link><pubDate>Wed, 27 Jan 2016 20:21:02 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:335c8206-5b0c-4924-9c18-fd6011062236</guid><dc:creator>Scott Kampa</dc:creator><comments>https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/26436/using-the-where-clause-and-duplicate-option-in-modelbuilder-to-filter-imported-data#comments</comments><description>Revision 1 posted to OpenFlows | Water Infrastructure Wiki by Scott Kampa on 1/27/2016 8:21:02 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img width="189" height="60" style="border-width:0px;" alt=" " src="/Other/Old_Site_Files/Bentley_Folders/m/support/17560/download.aspx" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table align="left" style="border:0px solid #dce5f0;width:500px;background-color:#dce5f0;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Bentley WaterGEMS, Bentley WaterCAD, Bentley HAMMER, Bentley SewerGEMS, Bentley SewerCAD, Bentley StormCAD, Bentley CivilStorm&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.xx.xx&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layout and Data Input&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scott Kampa, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;Problem&lt;/h1&gt;
&lt;p&gt;How is the WHERE statement in ModelBuilder used?&lt;/p&gt;
&lt;h1&gt;Solution&lt;/h1&gt;
&lt;p&gt;The WHERE statement is a SQL query that allows a user to filter the data in the source file before importing the data into a model file. As an example, you could use this if you only wanted to import a certain pipe material.&lt;/p&gt;
&lt;p&gt;In the first step of ModelBuilder, you specify the data source. After selecting the data source type and choosing the data source file itself, you can filter this checking the box next to the WHERE statement box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/photos/akshayas_images/images/56069/original.aspx" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;WHERE&amp;quot; statement applies only for selected layer (in this case, &amp;quot;PIPE []&amp;quot;), and different &amp;quot;WHERE&amp;quot; statements can be&amp;nbsp;specified for&amp;nbsp;different layers.&amp;nbsp;In the screenshot above, the WHERE statement is filtering the list of pipes to show only the pipes with a diameter of 16. Only these pipes would be included in the import at the end of the ModelBuilder process.&lt;/p&gt;
&lt;p&gt;If the column you want to filter on is a text field, the syntax for the WHERE statement will be similar to the following: Material = &amp;#39;Ductile Iron&amp;#39;. Note the use of a single quotation mark around the material type.&lt;/p&gt;
&lt;p&gt;Supported comparison operators are: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, =, IN and LIKE. Multiple logical statements can be combined by using AND, OR and NOT operators. Parentheses can be used to group statements and enforce precedence. The * and % wildcard can be used interchangeably in a LIKE statement. A wildcard is allowed at the beginning and/or end of a pattern. Wildcards are not allowed in the middle of a pattern.&lt;/p&gt;
&lt;p&gt;For more information on the WHERE statement and the expected syntax, see the Help topic &amp;quot;Specifying a SQL WHERE clause in ModelBuilder&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&amp;nbsp;&lt;/strong&gt;Some source file types, such as SDE files, allow the use of subtypes. If these exist in your source file, a WHERE statement will need to be included for each subtype.&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;See Also&lt;/h1&gt;
&lt;p&gt;&lt;a href="/Products/Hydraulics___Hydrology/w/Hydraulics_and_Hydrology__Wiki/building-a-model-using-model-builder"&gt;Building a model using ModelBuilder&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: ModelBuilder&lt;/div&gt;
</description></item></channel></rss>