{"id":175481,"date":"2011-06-06T18:00:25","date_gmt":"2011-06-06T18:00:25","guid":{"rendered":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=175481"},"modified":"2019-10-25T17:37:56","modified_gmt":"2019-10-26T00:37:56","slug":"if-you-are-stuck-at-if-part-1","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1","title":{"rendered":"If you are stuck at &#8220;if&#8221; \u2013 Part 1"},"author":4041,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23341],"tags":[24321,24331,24341,33131],"industry":[],"product":[36991],"class_list":["post-175481","blog","type-blog","status-publish","format-standard","hentry","category-analytics","tag-geoprocessing","tag-modelbuilder","tag-python","tag-tips-and-tricks","product-arcgis-desktop"],"acf":{"short_description":"If-then-else logic is a simple yet powerful concept for performing different actions based on different conditions.","flexible_content":[{"acf_fc_layout":"content","content":"<p>If-then-else logic is a simple yet powerful concept for performing different actions based on different conditions. If-then-else logic can be explained like this:<\/p>\n<pre>IF some condition is true, THEN\r\n   perform an action;\r\nELSE the condition is false,\r\n   perform a different action.<\/pre>\n<p>This is a three part blog which talks about different examples of if-then-else conditions and ways to implement it in ArcGIS.<\/p>\n<p><strong>Part 1<\/strong>\u00a0\u2013 Gives examples of quick and dirty ways of using the Calculate Value tool to create branches using if statements in a model.<\/p>\n<p><strong>Part 2<\/strong>\u00a0\u2013 Gives an example of creating and connecting an if-then-else script tool for branching in a model. The\u00a0<strong><em>If Product license exists<\/em><\/strong> example of Calculate value<br \/>\nfrom part 1 has been converted into script tools to explain the concepts.<\/p>\n<p><strong>Part 3<\/strong>\u00a0\u2013Gives three case examples of using script tools in a model. This part highlights the use of various capabilities of ModelBuilder such as:<\/p>\n<ul style=\"margin-left: 40px;\">\n<li>using a branching script in a model<\/li>\n<li>merging two branches<\/li>\n<li>creating model parameters<\/li>\n<li>using Value list filter in a model<\/li>\n<li>setting preconditions<\/li>\n<li>using an iterator in a model<\/li>\n<li>creating a nested model or a model within a model<\/li>\n<\/ul>\n"},{"acf_fc_layout":"content","content":"<hr \/>\n<p><strong>Examples of using the Calculate Value tool to create branches using if-else logic<\/strong><br \/>\nIn this blog part we cover five examples of using\u00a0<strong><em>if-then-else<\/em><\/strong>\u00a0logic code in the Calculate Value tool. There are various reasons to use either Calculate Value or a script tool for branching such as:<\/p>\n<p><strong>Reasons to use Calculate Value tool:<\/strong><\/p>\n<ul style=\"margin-left: 40px;\">\n<li>It is easy to use.<\/li>\n<li>The code remains inside the model as compared to a script tool which reference an external Python file.<\/li>\n<li>It has a built-in list of output data types.<\/li>\n<\/ul>\n<p><strong>Or there are reasons to use a Script tool:<\/strong><\/p>\n<ul style=\"margin-left: 40px;\">\n<li>It is easier to manage and debug large code examples using the Python IDE than in the Calculate Value tool.<\/li>\n<li>If the code has many if and else conditions or too many possibilities of what input value could be. For example, if you are creating an \u201cif\u201d tool for any type of input dataset. There are more than 20 possible dataset types and it will make the code block in the Calculate Value tool too big to manage and debug.<\/li>\n<li>The Calculate Value tool only has one output Boolean parameter (either true or false) so if you want to check for multiple conditions you have to add the Calculate Value tool multiple times with the logic to test against. For Example \u2013 Suppose you want to check if the input is a shapefile or a feature class from a geodatabase. The only way to do this is to add two Calculate Value tools and add the logic for checking just for the shapefile or just the feature class separately. In comparison the script tool can have two output Boolean parameters from a single tool and the tool redundancy can be avoided by adding the logic for both the checks in a single script tool.<\/li>\n<li>If scripts are your style and comfort preference (Oh yes! I have heard this from many)<\/li>\n<\/ul>\n<p><strong>Where to start?<\/strong><\/p>\n<p>Just in case you are new to ModelBuilder you might want to start with the following topic and tutorials:<\/p>\n<ul style=\"margin-left: 40px;\">\n<li><a title=\"What is ModelBuilder?\" href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/What_is_ModelBuilder\/002w00000001000000\/\">What is ModelBuilder?<\/a><\/li>\n<li><a title=\"Executing tools in ModelBuilder\" href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/Tutorial_Executing_tools_in_ModelBuilder\/002w0000007t000000\/\">Executing tools in ModelBuilder<\/a><\/li>\n<li><a title=\"Creating tools with ModelBuilder\" href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/Tutorial_Creating_tools_with_ModelBuilder\/002w0000007v000000\/\">Creating tools with ModelBuilder<\/a><\/li>\n<\/ul>\n<p>Now that you are comfortable with the ModelBuilder interface and vocabulary you can get started with this blog by\u00a0<a title=\"If-Then-Else Example\" href=\"http:\/\/angp.maps.arcgis.com\/home\/item.html?id=32d0c3b5d93f4ff0b1ba00a598ceb875#\">downloading the models from here<\/a>.<\/p>\n<p>You can access the Calculate Value tool in ModelBuilder from the Insert &gt; Model Only tools menu or right click side menu. Calculate Value tool returns a value based on a specified Python expression. Learn more about the tool by clicking\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/Calculate_Value\/004000000004000000\/\">here<\/a>.<\/p>\n"},{"acf_fc_layout":"content","content":"<hr \/>\n<p><strong>Example 1 \u2013 If Product License Exists<\/strong><br \/>\nTools have different license level requirements. Some tools run at ArcView level while others need an ArcInfo license. If you want to run tools based on product license levels in a model a quick way to check is by using if logic in Calculate Value tool.<\/p>\n<p>The following example uses the Erase tool if the ArcInfo license is available and uses a combination of multiple tools to execute the same simple task as the Erase tool if the license is not available. You need to have some knowledge of the license level requirement for each tool. You can easily check this from the individual tool documentation.<\/p>\n<p>The check is especially important, if you are sharing the models with your peers as the product level could be different from one user to another, and using this license level check can significantly minimizes the processing time, especially if it is a big model or large data.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse11.png\" alt=\"\" \/><\/p>\n<p>For all examples the\u00a0<strong><em>if-then-else<\/em><\/strong>\u00a0code in Calculate Value tool is written in Python using\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/What_is_ArcPy\/000v000000v7000000\/\">ArcPy<\/a>, a Python site package that encompasses and further enhances the arcgisscripting module. This example uses the ArcPy\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/ProductInfo\/000v0000003v000000\/\">ProductInfo<\/a>\u00a0function to check the availability of the product license and sets the Boolean output parameter to true or false based on the if condition.<\/p>\n<div>\n<table width=\"718\">\n<tbody>\n<tr>\n<td>If Product License\u00a0<strong><em>Exists<\/em><\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse12.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong><\/p>\n<pre>x(\"%ProductToCheck%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(ProductToCheck): import arcpy if arcpy.ProductInfo() == ProductToCheck: return <strong>\"true\"<\/strong> else: return <strong>\"false\"<\/strong><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>If Product License\u00a0<strong><em>Does Not Exist<\/em><\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse13.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>x(\"%ProductToCheck%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(ProductToCheck): import arcpy if arcpy.ProductInfo() == ProductToCheck: return <strong>\"false\"<\/strong> else: return \"true\"<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n"},{"acf_fc_layout":"content","content":"<hr \/>\n<p><strong>Example 2 \u2013 If Extension Exists<\/strong><br \/>\nEsri offers a wide range of optional extensions that can dramatically expand the capabilities of ArcGIS. Some of these ArcGIS tools are packaged in different extensions. The following example executes the Geographically Weighted Regression tool from Spatial Statistics toolbox. Geographically Weighted Regression requires an ArcInfo license or the Spatial Analyst extension or the Geostatistical Analyst extension. The example model checks to see if an ArcInfo license is available just as in the previous example and if the license is not available checks to see if either the Spatial or Geostats extension is available using the Calculate Value tool. The Boolean outputs (True and False) are passed to the Merge Branch, a tool often used in if-then-else logic. Merge Branch takes any number of inputs and these inputs can be of any data type (feature layer, Boolean, String, Double, and so on). When Merge Branch executes, it examines the list of inputs, and outputs the first valid value it finds. In the case of Booleans, it examines the list and outputs the True if any of the inputs are true. If none of the inputs are true, the output of Merge Branch is<br \/>\nfalse.<\/p>\n<p>If neither the product license (ArcInfo) nor any of the two extensions are available the tool does not execute.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse14.png\" alt=\"\" width=\"604\" height=\"450\" \/><\/p>\n<p>The example uses the\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/CheckExtension\/000v0000003n000000\/\">CheckExtension<\/a>\u00a0acrpy function to check the availability of the extension and\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/CheckOutExtension\/000v0000003q000000\/\">CheckOutExtension<\/a>\u00a0function to check out the extension for use.<\/p>\n<div>\n<table width=\"748\">\n<tbody>\n<tr>\n<td>If Extension\u00a0<strong><em>Exists<\/em><\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse15.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>getExtension()<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def getExtension(): import arcpy if arcpy.CheckExtension<strong>(\"Spatial\")<\/strong> == \"Available\": arcpy.CheckOutExtension(<strong>\"Spatial\")<\/strong> return \"true\" elif arcpy.CheckExtension(<strong>\"Geostats\")<\/strong> == \"Available\": arcpy.CheckOutExtension(<strong>\"Geostats\")<\/strong> return \"true\" else: return \"false\"<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n"},{"acf_fc_layout":"content","content":"<hr \/>\n<p><strong>Example 3 \u2013 If Feature Class Exists<\/strong><br \/>\nIn this example the Calculate Value tool checks if a feature class exists in a workspace and if it exists, adds a field, adds a string value of \u201cExisting \u201cusing the Calculate Field tool. If it does not exists the model copies the feature class from a backup location, adds a field, calculates that field with values of the date and time that it was copied and then the two feature classes are input to Merge Branch tool. Merge Branch examines which one has been updated with a valid value and outputs the feature class to merge with the other two feature classes.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse16.png\" alt=\"\" \/><\/p>\n<p>The example uses the\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/\/000v00000021000000.htm\">Exists<\/a>\u00a0arcpy function to check if the feature class exists.<\/p>\n<div>\n<table width=\"718\">\n<tbody>\n<tr>\n<td>If Feature Class\u00a0<strong><em>Exists<\/em><\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse17.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>x(\"%FeatureClassToCheck%\", \"%Workspace%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(FeatureClassToCheck, Workspace): import arcpy arcpy.env.workspace = Workspace if arcpy.Exists(FeatureClassToCheck): return <strong>\"true\"<\/strong> else: return \"false\"<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>If Feature Class\u00a0<strong><em>Does Not Exist<\/em><\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse18.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>x(\"%FeatureClassToCheck%\", \"%Workspace%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(FeatureClassToCheck, Workspace): import arcpy arcpy.env.workspace = Workspace if arcpy.Exists(FeatureClassToCheck): return <strong>\"false\"<\/strong> else: return <strong>\"true\"<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n"},{"acf_fc_layout":"content","content":"<hr \/>\n<p><strong>Example 4 \u2013 If the input is Point, Polyline or Polygon Features Class<\/strong><br \/>\nIf you want to find whether the input feature class is a point, line or polygon you can use a simple if logic in the Calculate Value tool. For example if the input feature class is a polygon then the Feature To Point tool converts the input into a point features class and uses it for a network analysis. If the input is points, it uses the point feature class directly into the network analysis. You can check if the input is a Line or a Point in the similar way as shown in the example below.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse19.png\" alt=\"\" \/><\/p>\n<p>The example uses the\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/Describe\/000v00000026000000\/\">Describe<\/a>\u00a0function to describe the shape type of the data.<\/p>\n<div>\n<table width=\"718\">\n<tbody>\n<tr>\n<td>If Feature Type\u00a0<strong><em>Exists<\/em><\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse110.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>x(r\"%InputFeatureClass%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(InputFeatureClass): import arcpy desc = arcpy.Describe(InputFeatureClass) type = desc.shapeType if type == \"Polygon\": return <strong>\"true\"<\/strong> else: return \"false\"<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n"},{"acf_fc_layout":"content","content":"<hr \/>\n<p><strong>Example 5 \u2013 If Feature Type Exists<\/strong><br \/>\nYou can check whether the input to your model is a shapefile or a feature class from a geodatabase using the Calculate Value tool as shown in this example. It checks to see if the input is a shapefile then adds a field and calculates area before calculating population density for the block groups. If it is a feature class from a geodatabase the area field already exists and the model can directly proceed to calculate population density. You can extend the same logic to find whether the input is a layer file or a feature layer in the map\u2019s table of content.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse111.png\" alt=\"\" \/><\/p>\n<p>The example uses the\u00a0<a href=\"http:\/\/help.arcgis.com\/en\/arcgisdesktop\/10.0\/help\/index.html#\/Describe\/000v00000026000000\/\">Describe<\/a> to describe the data type of the data.<\/p>\n<div>\n<table width=\"718\">\n<tbody>\n<tr>\n<td>If input is a\u00a0<strong>Shapefile<\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse112.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>x(r\"%InputData%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(InputData): import arcpy desc = arcpy.Describe(InputData) type = desc.datatype if type == \"ShapeFile\": return <strong>\"true\"<\/strong> else: return \"false\"<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>If input is a\u00a0<strong>Feature Class<\/strong>Condition<\/td>\n<td><img decoding=\"async\" src=\"http:\/\/edn1.esri.com\/blogimages\/gp\/060411_0040_IfThenElse113.png\" alt=\"\" \/><\/td>\n<td><strong>Expression<\/strong>;<\/p>\n<pre>x(r\"%InputData%\")<\/pre>\n<p><strong>Code Block<\/strong><\/p>\n<pre>def x(InputData): import arcpy desc = arcpy.Describe(InputData) type = desc.datatype if type == \"FeatureClass\": return <strong>\"true\"<\/strong> else: return \"false\"<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n"}],"authors":[{"ID":4041,"user_firstname":"Shitij","user_lastname":"Mehta","nickname":"Shitij Mehta","user_nicename":"shitijmehta","display_name":"Shitij Mehta","user_email":"smehta@esri.com","user_url":"","user_registered":"2018-03-02 00:15:39","user_description":"Shitij is the product owner for ModelBuilder in ArcGIS Desktop and leads ModelBuilder efforts in web environments at Esri. She oversees the full product lifecycle\u2014from feature design and development to testing and refinement\u2014ensuring a seamless experience for users. Beyond the office, Shitij is a Heartfulness meditation trainer, dedicated volunteer, and passionate researcher focused on tigers and elephants.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/10\/SM.png' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":"","card_image":false,"wide_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>If you are stuck at &quot;if&quot; \u2013 Part 1<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"If you are stuck at &quot;if&quot; \u2013 Part 1\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-26T00:37:56+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\"},\"author\":{\"name\":\"Shitij Mehta\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e535f780f7b06cceac95bb5b8a079f16\"},\"headline\":\"If you are stuck at &#8220;if&#8221; \u2013 Part 1\",\"datePublished\":\"2011-06-06T18:00:25+00:00\",\"dateModified\":\"2019-10-26T00:37:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\"},\"wordCount\":7,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"geoprocessing\",\"ModelBuilder\",\"python\",\"tips and tricks\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\",\"name\":\"If you are stuck at \\\"if\\\" \u2013 Part 1\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2011-06-06T18:00:25+00:00\",\"dateModified\":\"2019-10-26T00:37:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"If you are stuck at &#8220;if&#8221; \u2013 Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e535f780f7b06cceac95bb5b8a079f16\",\"name\":\"Shitij Mehta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/10\/SM.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/10\/SM.png\",\"caption\":\"Shitij Mehta\"},\"description\":\"Shitij is the product owner for ModelBuilder in ArcGIS Desktop and leads ModelBuilder efforts in web environments at Esri. She oversees the full product lifecycle\u2014from feature design and development to testing and refinement\u2014ensuring a seamless experience for users. Beyond the office, Shitij is a Heartfulness meditation trainer, dedicated volunteer, and passionate researcher focused on tigers and elephants.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/shitijmehta\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"If you are stuck at \"if\" \u2013 Part 1","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1","og_locale":"en_US","og_type":"article","og_title":"If you are stuck at \"if\" \u2013 Part 1","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2019-10-26T00:37:56+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1"},"author":{"name":"Shitij Mehta","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e535f780f7b06cceac95bb5b8a079f16"},"headline":"If you are stuck at &#8220;if&#8221; \u2013 Part 1","datePublished":"2011-06-06T18:00:25+00:00","dateModified":"2019-10-26T00:37:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1"},"wordCount":7,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["geoprocessing","ModelBuilder","python","tips and tricks"],"articleSection":["Analytics"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1","name":"If you are stuck at \"if\" \u2013 Part 1","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2011-06-06T18:00:25+00:00","dateModified":"2019-10-26T00:37:56+00:00","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/if-you-are-stuck-at-if-part-1#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"If you are stuck at &#8220;if&#8221; \u2013 Part 1"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e535f780f7b06cceac95bb5b8a079f16","name":"Shitij Mehta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/10\/SM.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/10\/SM.png","caption":"Shitij Mehta"},"description":"Shitij is the product owner for ModelBuilder in ArcGIS Desktop and leads ModelBuilder efforts in web environments at Esri. She oversees the full product lifecycle\u2014from feature design and development to testing and refinement\u2014ensuring a seamless experience for users. Beyond the office, Shitij is a Heartfulness meditation trainer, dedicated volunteer, and passionate researcher focused on tigers and elephants.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/shitijmehta"}]}},"text_date":"June 6, 2011","author_name":"Shitij Mehta","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/shitijmehta","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/08\/Newsroom-Keyart-Wide-1920-x-1080.jpg","primary_product":"ArcMap","tag_data":[{"term_id":24321,"name":"geoprocessing","slug":"geoprocessing","term_group":0,"term_taxonomy_id":24321,"taxonomy":"post_tag","description":"","parent":0,"count":131,"filter":"raw"},{"term_id":24331,"name":"ModelBuilder","slug":"modelbuilder","term_group":0,"term_taxonomy_id":24331,"taxonomy":"post_tag","description":"","parent":0,"count":28,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"},{"term_id":33131,"name":"tips and tricks","slug":"tips-and-tricks","term_group":0,"term_taxonomy_id":33131,"taxonomy":"post_tag","description":"","parent":0,"count":26,"filter":"raw"}],"category_data":[{"term_id":23341,"name":"Analytics","slug":"analytics","term_group":0,"term_taxonomy_id":23341,"taxonomy":"category","description":"","parent":0,"count":1333,"filter":"raw"}],"product_data":[{"term_id":36991,"name":"ArcMap","slug":"arcgis-desktop","term_group":0,"term_taxonomy_id":36991,"taxonomy":"product","description":"","parent":36981,"count":325,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-desktop","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/175481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/4041"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=175481"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/175481\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=175481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=175481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=175481"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=175481"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=175481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}