<?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: Python If Then label expression in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521985#M29705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might like to "Define classes of features and label each class differently" from Layer Properties.&lt;/P&gt;&lt;P&gt;1. Choose the above method.&lt;/P&gt;&lt;P&gt;2. Add a new class. Define a class name.&lt;/P&gt;&lt;P&gt;3. Define a SQL query (&lt;SPAN style="background-color: #ffffff;"&gt;Sulfate_9_2016 &amp;gt;300000)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;4. Write the appropriate expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;5. Choose appropriate symbology.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/306975_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 22 Jan 2017 19:30:53 GMT</pubDate>
    <dc:creator>JayantaPoddar</dc:creator>
    <dc:date>2017-01-22T19:30:53Z</dc:date>
    <item>
      <title>Python If Then label expression</title>
      <link>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521984#M29704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to label some wells with their ID and the sulfate concentrations from multiple sampling events. I started by labeling the wells from just one event, I wrote a python expression that would label a well with its name and the sulfate concentration in red if its over 300,000. The expression has no errors but it labels all the sulfate concentrations in red regardless of the number. It also breaks up the label wherever there is a comma. I know I could do this in SQL, but eventually I need to add multiple sulfate concentrations to this label.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def FindLabel ( [Well_Nme], [Sulfate_9_2016] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt; if ([Sulfate_9_2016]) &amp;gt;300000:&lt;BR /&gt; return [Well_Nme] +'\r\n'+ "&amp;lt;CLR red='255'&amp;gt;" + [Sulfate_9_2016] + "&amp;lt;/CLR&amp;gt;"&lt;BR /&gt; elif [Sulfate_9_2016] &amp;lt;300000:&lt;BR /&gt; return [Well_Nme]+'\r\n'+ [Sulfate_9_2016]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2017 17:03:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521984#M29704</guid>
      <dc:creator>GrantHaynes</dc:creator>
      <dc:date>2017-01-22T17:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python If Then label expression</title>
      <link>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521985#M29705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might like to "Define classes of features and label each class differently" from Layer Properties.&lt;/P&gt;&lt;P&gt;1. Choose the above method.&lt;/P&gt;&lt;P&gt;2. Add a new class. Define a class name.&lt;/P&gt;&lt;P&gt;3. Define a SQL query (&lt;SPAN style="background-color: #ffffff;"&gt;Sulfate_9_2016 &amp;gt;300000)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;4. Write the appropriate expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;5. Choose appropriate symbology.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/306975_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2017 19:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521985#M29705</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2017-01-22T19:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python If Then label expression</title>
      <link>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521986#M29706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to stick with a script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; FindLabel &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Well_Nme&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Sulfate_9_2016&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; lbl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Well_Nme&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\r\n"&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&amp;nbsp; float&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Sulfate_9_2016&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;300000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lbl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lbl &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"&amp;lt;CLR red='255'&amp;gt;"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Sulfate_9_2016&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"&amp;lt;/CLR&amp;gt;"&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lbl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lbl &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"&amp;lt;CLR red='0'&amp;gt;"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Sulfate_9_2016&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"&amp;lt;/CLR&amp;gt;"&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; lbl‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:46:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/python-if-then-label-expression/m-p/521986#M29706</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2021-12-11T22:46:17Z</dc:date>
    </item>
  </channel>
</rss>

