<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create single feature when using Feature Sets in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776816#M1422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short yes, but requires ingenuity. Which in a sense I have done for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the end model (this is example data as scenario, you will only need the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; and &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; Part):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="431776" alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/431776_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you already have a &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; (as it is an input to a tool) you'll insert the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; and &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; as a precondition to the tool the &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; would connect to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this scenario I want to add new schools to the existing feature class (Existing Schools) using the &lt;STRONG&gt;Append Tool&lt;/STRONG&gt;. The New School Locations is the &lt;STRONG&gt;Feature Set&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; tool with the &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; as the input, make sure to rename the output variable to &lt;STRONG&gt;&lt;EM&gt;rowcount&lt;/EM&gt;&lt;/STRONG&gt; (this is important because this output is used in the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; expression/code block).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool (model builder only tool- in &lt;STRONG&gt;&lt;EM&gt;Model Builder &amp;gt; Insert &amp;gt; Model Only Tools &amp;gt; Calculate Value&lt;/EM&gt;&lt;/STRONG&gt;). Set the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; output as a precondition to the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; as we need the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; to run first to count how many features are added to the in-memory table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right click and Open the&amp;nbsp;&lt;STRONG&gt;Calculate Value&lt;/STRONG&gt;&amp;nbsp;tool to modify the expression and code block. This is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Expression:&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;countRows("%rowcount%")&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Code Block (optional):&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;def countRows(RowCount):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; import arcpy&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if %RowCount% == 2:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return "true"&lt;BR /&gt; else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return "false"&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;IMG __jive_id="431795" alt="" class="jive-image image-2 j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/431795_2.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;P&gt;This code is short looks at the output of the &lt;STRONG&gt;Get Count&amp;nbsp;&lt;/STRONG&gt;tool (the rows added to the in-memory table; if you add one feature its 1 row, two features 2 rows and so on) for your case set the value to two&amp;nbsp;(2) so that when your user clicks a start and end which creates two features in the in-memory table. &lt;EM&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;STRONG&gt;this may be different as your environment/model parameters/etc may have different requirements. This model uses point features and you may be using line features.)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then set the output of the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool as a precondition to your current model's first tool in which your &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; was connected as an input.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When run, the tool will only work if there is&amp;nbsp;two points selected. Otherwise the tool will provide an informative message saying "&lt;SPAN style="color: #339966;"&gt;The process did not execute because the precondition is false.&lt;SPAN style="color: #000000;"&gt;" The false precondition is that the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool's if statement was not met, meaning an input of anything but two selections.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600; font-size: 22px;"&gt;The&amp;nbsp;model will run as "&lt;STRONG&gt;Completed&lt;/STRONG&gt;" regardless of whether the user selects the desired amount of inputs or not because&amp;nbsp;the in the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool outputs a Boolean value which is just true or false. There are ways to prompt error messaging in your model. But that for another GeoNet Post.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Dec 2018 17:55:13 GMT</pubDate>
    <dc:creator>JakeSimms1</dc:creator>
    <dc:date>2018-12-17T17:55:13Z</dc:date>
    <item>
      <title>Create single feature when using Feature Sets</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776815#M1421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I have an existing model which is used in ArcGIS Desktop 10.3 which I would like to improve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the model the user&amp;nbsp;chooses a start and end point on the map and the model then calculates distances using different methods. The start and end points have been configured as feature sets and are&amp;nbsp;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;interactively entered from the model tool dialog box.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue I have is that there is nothing&amp;nbsp;stopping the user clicking more than once and ending up with multiple start and end points. This provides a poor user experience and breaks the model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone tell me whether it is possible when using feature sets to restrict the user to only&amp;nbsp;creating one feature? Alternatively, can anyone suggest a neat way of taking a feature set with multiple features and reducing it to one feature?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Andrew.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:57:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776815#M1421</guid>
      <dc:creator>AndrewWillingale</dc:creator>
      <dc:date>2018-07-13T15:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create single feature when using Feature Sets</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776816#M1422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short yes, but requires ingenuity. Which in a sense I have done for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the end model (this is example data as scenario, you will only need the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; and &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; Part):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="431776" alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/431776_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you already have a &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; (as it is an input to a tool) you'll insert the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; and &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; as a precondition to the tool the &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; would connect to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this scenario I want to add new schools to the existing feature class (Existing Schools) using the &lt;STRONG&gt;Append Tool&lt;/STRONG&gt;. The New School Locations is the &lt;STRONG&gt;Feature Set&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; tool with the &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; as the input, make sure to rename the output variable to &lt;STRONG&gt;&lt;EM&gt;rowcount&lt;/EM&gt;&lt;/STRONG&gt; (this is important because this output is used in the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; expression/code block).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool (model builder only tool- in &lt;STRONG&gt;&lt;EM&gt;Model Builder &amp;gt; Insert &amp;gt; Model Only Tools &amp;gt; Calculate Value&lt;/EM&gt;&lt;/STRONG&gt;). Set the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; output as a precondition to the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; as we need the &lt;STRONG&gt;Get Count&lt;/STRONG&gt; to run first to count how many features are added to the in-memory table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right click and Open the&amp;nbsp;&lt;STRONG&gt;Calculate Value&lt;/STRONG&gt;&amp;nbsp;tool to modify the expression and code block. This is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Expression:&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;countRows("%rowcount%")&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Code Block (optional):&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;def countRows(RowCount):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; import arcpy&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if %RowCount% == 2:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return "true"&lt;BR /&gt; else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return "false"&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;IMG __jive_id="431795" alt="" class="jive-image image-2 j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/431795_2.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;P&gt;This code is short looks at the output of the &lt;STRONG&gt;Get Count&amp;nbsp;&lt;/STRONG&gt;tool (the rows added to the in-memory table; if you add one feature its 1 row, two features 2 rows and so on) for your case set the value to two&amp;nbsp;(2) so that when your user clicks a start and end which creates two features in the in-memory table. &lt;EM&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;STRONG&gt;this may be different as your environment/model parameters/etc may have different requirements. This model uses point features and you may be using line features.)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then set the output of the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool as a precondition to your current model's first tool in which your &lt;STRONG&gt;Feature Set&lt;/STRONG&gt; was connected as an input.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When run, the tool will only work if there is&amp;nbsp;two points selected. Otherwise the tool will provide an informative message saying "&lt;SPAN style="color: #339966;"&gt;The process did not execute because the precondition is false.&lt;SPAN style="color: #000000;"&gt;" The false precondition is that the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool's if statement was not met, meaning an input of anything but two selections.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600; font-size: 22px;"&gt;The&amp;nbsp;model will run as "&lt;STRONG&gt;Completed&lt;/STRONG&gt;" regardless of whether the user selects the desired amount of inputs or not because&amp;nbsp;the in the &lt;STRONG&gt;Calculate Value&lt;/STRONG&gt; tool outputs a Boolean value which is just true or false. There are ways to prompt error messaging in your model. But that for another GeoNet Post.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Dec 2018 17:55:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776816#M1422</guid>
      <dc:creator>JakeSimms1</dc:creator>
      <dc:date>2018-12-17T17:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create single feature when using Feature Sets</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776817#M1423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks for this Jake, it's greatly appreciated. I'll try and&amp;nbsp;give this a go in the new year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Andrew.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2018 14:08:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/create-single-feature-when-using-feature-sets/m-p/776817#M1423</guid>
      <dc:creator>AndrewWillingale</dc:creator>
      <dc:date>2018-12-21T14:08:49Z</dc:date>
    </item>
  </channel>
</rss>

