<?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: Expression to define symbology in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/expression-to-define-symbology/m-p/1307813#M71008</link>
    <description>&lt;P&gt;Add a field to store the value you want to use with &lt;EM&gt;Unique Values&lt;/EM&gt; symbology e.g. "&lt;STRONG&gt;symbol_class&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;Then populate that field -&amp;nbsp; if there is a Level5 value, use it, else look at the previous levels until you either have a class or there is none.&amp;nbsp; Since you may have nulls or spaces, or empty strings, handle those too.&lt;/P&gt;&lt;P&gt;The code for determining the class to use for symbology would be:&lt;/P&gt;&lt;PRE&gt;def getSymbolClass (Level1,Level2,Level3,Level4,Level5 ):&lt;BR /&gt;    if Level5 is not None and str(Level5).strip() != "":&lt;BR /&gt;        return Level5&lt;BR /&gt;    if Level4 is not None and str(Level4).strip() != "":&lt;BR /&gt;        return Level4&lt;BR /&gt;    if Level3 is not None and str(Level3).strip() != "":&lt;BR /&gt;       return Level3&lt;BR /&gt;    if Level2 is not None and str(Level2).strip() != "":&lt;BR /&gt;        return Level2&lt;BR /&gt;    if Level1 is not None and str(Level1).strip() != "":&lt;BR /&gt;        return Level1&lt;BR /&gt;    else:&lt;BR /&gt;        return "no class"&lt;/PRE&gt;&lt;P&gt;Used in the context of CalculateField:&lt;/P&gt;&lt;PRE&gt;arcpy.management.CalculateField("test", "symbol_class", "getSymbolClass(!Level1!,!Level2!,!Level3!,!Level4!,!Level5!)", "PYTHON3", """def getSymbolClass (Level1,Level2,Level3,Level4,Level5 ):&lt;BR /&gt;if Level5 is not None and str(Level5).strip() != "":&lt;BR /&gt;return Level5&lt;BR /&gt;if Level4 is not None and str(Level4).strip() != "":&lt;BR /&gt;return Level4&lt;BR /&gt;if Level3 is not None and str(Level3).strip() != "":&lt;BR /&gt;return Level3&lt;BR /&gt;if Level2 is not None and str(Level2).strip() != "":&lt;BR /&gt;return Level2&lt;BR /&gt;if Level1 is not None and str(Level1).strip() != "":&lt;BR /&gt;return Level1&lt;BR /&gt;else:&lt;BR /&gt;return "no class" """, "TEXT", "NO_ENFORCE_DOMAINS")&lt;/PRE&gt;&lt;P&gt;Repace "Test" with the name of your layer.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2023 02:44:29 GMT</pubDate>
    <dc:creator>MicZatorsky_AEC</dc:creator>
    <dc:date>2023-07-13T02:44:29Z</dc:date>
    <item>
      <title>Expression to define symbology</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/expression-to-define-symbology/m-p/1306124#M70855</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a habitat mapping feature layer and need to write an expression to exclude null fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the layer setup with 5 fields utilising contingency selects (which is also not currently working on ArcGIS online but is on fieldmaps and pro). I need the symbology to select the field with a non empty cell to generate the appropriate symbology for that field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have build it as below with 5 levels of habitat characterisation of which I need it to be weighted to level 5, by which I need it to select the furthest right value which isn't null.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GIS_Ecologist_0-1688648840817.png" style="width: 561px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74897iFFC91549DE88FF38/image-dimensions/561x122?v=v2" width="561" height="122" role="button" title="GIS_Ecologist_0-1688648840817.png" alt="GIS_Ecologist_0-1688648840817.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help on this would be much appreciated. I am fairly new to writing expressions and don't really know where to start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and look forward to seeing your replies&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 13:12:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/expression-to-define-symbology/m-p/1306124#M70855</guid>
      <dc:creator>GIS_Ecologist</dc:creator>
      <dc:date>2023-07-06T13:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to define symbology</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/expression-to-define-symbology/m-p/1307813#M71008</link>
      <description>&lt;P&gt;Add a field to store the value you want to use with &lt;EM&gt;Unique Values&lt;/EM&gt; symbology e.g. "&lt;STRONG&gt;symbol_class&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;Then populate that field -&amp;nbsp; if there is a Level5 value, use it, else look at the previous levels until you either have a class or there is none.&amp;nbsp; Since you may have nulls or spaces, or empty strings, handle those too.&lt;/P&gt;&lt;P&gt;The code for determining the class to use for symbology would be:&lt;/P&gt;&lt;PRE&gt;def getSymbolClass (Level1,Level2,Level3,Level4,Level5 ):&lt;BR /&gt;    if Level5 is not None and str(Level5).strip() != "":&lt;BR /&gt;        return Level5&lt;BR /&gt;    if Level4 is not None and str(Level4).strip() != "":&lt;BR /&gt;        return Level4&lt;BR /&gt;    if Level3 is not None and str(Level3).strip() != "":&lt;BR /&gt;       return Level3&lt;BR /&gt;    if Level2 is not None and str(Level2).strip() != "":&lt;BR /&gt;        return Level2&lt;BR /&gt;    if Level1 is not None and str(Level1).strip() != "":&lt;BR /&gt;        return Level1&lt;BR /&gt;    else:&lt;BR /&gt;        return "no class"&lt;/PRE&gt;&lt;P&gt;Used in the context of CalculateField:&lt;/P&gt;&lt;PRE&gt;arcpy.management.CalculateField("test", "symbol_class", "getSymbolClass(!Level1!,!Level2!,!Level3!,!Level4!,!Level5!)", "PYTHON3", """def getSymbolClass (Level1,Level2,Level3,Level4,Level5 ):&lt;BR /&gt;if Level5 is not None and str(Level5).strip() != "":&lt;BR /&gt;return Level5&lt;BR /&gt;if Level4 is not None and str(Level4).strip() != "":&lt;BR /&gt;return Level4&lt;BR /&gt;if Level3 is not None and str(Level3).strip() != "":&lt;BR /&gt;return Level3&lt;BR /&gt;if Level2 is not None and str(Level2).strip() != "":&lt;BR /&gt;return Level2&lt;BR /&gt;if Level1 is not None and str(Level1).strip() != "":&lt;BR /&gt;return Level1&lt;BR /&gt;else:&lt;BR /&gt;return "no class" """, "TEXT", "NO_ENFORCE_DOMAINS")&lt;/PRE&gt;&lt;P&gt;Repace "Test" with the name of your layer.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 02:44:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/expression-to-define-symbology/m-p/1307813#M71008</guid>
      <dc:creator>MicZatorsky_AEC</dc:creator>
      <dc:date>2023-07-13T02:44:29Z</dc:date>
    </item>
  </channel>
</rss>

