<?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 Modelbuilder - calculate values - if feature exists in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-calculate-values-if-feature-exists/m-p/701712#M3246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to modelbuilder and a noob in python.&lt;/P&gt;&lt;P&gt;I am trying to take a snippet of a py code from the ESRI blog particularly example 3 to use in my model.&lt;/P&gt;&lt;P&gt;My goal is to check if a "Polygons" fc exists in a gdb and if it does not return true to run a set of additional gp tools.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://blogs.esri.com/esri/arcgis/2011/06/06/modelbuilderifthenelse1/" rel="nofollow" target="_blank"&gt;If you are stuck at "if" – Part 1 | ArcGIS Blog&lt;/A&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create variable&lt;/P&gt;&lt;P&gt;- Workspace&amp;nbsp; - workspace variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - location of gdb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - set as parameter for input as a tool&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- FeatureClasstoCheck - feature class variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - fc located in a feature dataset of the workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - set as input of based on parameter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - %workspace%\Placemarks\Polygons&amp;nbsp;&amp;nbsp; ??&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14.2857141494751px; background: #ffffff;"&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif;"&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: transparent;"&gt;x("%FeatureClassToCheck%", "%Workspace%")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background: #ffffff; font-size: 14.2857141494751px; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;STRONG&gt;Code Block&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;def x(FeatureClassToCheck, Workspace):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(FeatureClassToCheck):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return "true"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return "false"&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Boolean&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now everytime I run this script, it returns a false value even though a actual Polygons fc exists.&amp;nbsp; I've tried hardcoding the location of the gdb and feature class in the script but it still returns a false value. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive also tried to just copy the Polygons fc into the parent gdb and just running %workspace%\Polygons but still returns a false value.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working in a citrix environment so I am not sure if that could be an issue? &lt;/P&gt;&lt;P&gt;ie workspace location:&amp;nbsp; \\abc.com\PROFILES\RemoteDesktop\chow\desktop\workspace\test.gdb&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions? &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Nov 2014 00:48:54 GMT</pubDate>
    <dc:creator>WilliamChow</dc:creator>
    <dc:date>2014-11-13T00:48:54Z</dc:date>
    <item>
      <title>Modelbuilder - calculate values - if feature exists</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-calculate-values-if-feature-exists/m-p/701712#M3246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to modelbuilder and a noob in python.&lt;/P&gt;&lt;P&gt;I am trying to take a snippet of a py code from the ESRI blog particularly example 3 to use in my model.&lt;/P&gt;&lt;P&gt;My goal is to check if a "Polygons" fc exists in a gdb and if it does not return true to run a set of additional gp tools.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://blogs.esri.com/esri/arcgis/2011/06/06/modelbuilderifthenelse1/" rel="nofollow" target="_blank"&gt;If you are stuck at "if" – Part 1 | ArcGIS Blog&lt;/A&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create variable&lt;/P&gt;&lt;P&gt;- Workspace&amp;nbsp; - workspace variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - location of gdb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - set as parameter for input as a tool&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- FeatureClasstoCheck - feature class variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - fc located in a feature dataset of the workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - set as input of based on parameter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - %workspace%\Placemarks\Polygons&amp;nbsp;&amp;nbsp; ??&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14.2857141494751px; background: #ffffff;"&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif;"&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: transparent;"&gt;x("%FeatureClassToCheck%", "%Workspace%")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background: #ffffff; font-size: 14.2857141494751px; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;STRONG&gt;Code Block&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;def x(FeatureClassToCheck, Workspace):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(FeatureClassToCheck):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return "true"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return "false"&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Boolean&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now everytime I run this script, it returns a false value even though a actual Polygons fc exists.&amp;nbsp; I've tried hardcoding the location of the gdb and feature class in the script but it still returns a false value. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive also tried to just copy the Polygons fc into the parent gdb and just running %workspace%\Polygons but still returns a false value.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working in a citrix environment so I am not sure if that could be an issue? &lt;/P&gt;&lt;P&gt;ie workspace location:&amp;nbsp; \\abc.com\PROFILES\RemoteDesktop\chow\desktop\workspace\test.gdb&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions? &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 00:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-calculate-values-if-feature-exists/m-p/701712#M3246</guid>
      <dc:creator>WilliamChow</dc:creator>
      <dc:date>2014-11-13T00:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Modelbuilder - calculate values - if feature exists</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-calculate-values-if-feature-exists/m-p/701713#M3247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a guess based on something different between the ArcGIS help code example and your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arcpy.env.workspace = Workspace&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;env.workspace = Workspace&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on ESRI's sample code in: &lt;/P&gt;&lt;P&gt;Checking for the existence of data&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001p000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001p000000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not an expert on Python; but maybe that one syntax change may resolve the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris Donohue, GISP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 19:55:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-calculate-values-if-feature-exists/m-p/701713#M3247</guid>
      <dc:creator>ChrisDonohue__GISP</dc:creator>
      <dc:date>2014-11-20T19:55:54Z</dc:date>
    </item>
  </channel>
</rss>

