<?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: Creating multiple commands within Label Expression - Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199845#M15358</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ha! Oops. The little things one doesn't realize. That will make it so much cleaner. Thank you, Richard!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Mar 2015 21:19:37 GMT</pubDate>
    <dc:creator>MaeganSalinas</dc:creator>
    <dc:date>2015-03-20T21:19:37Z</dc:date>
    <item>
      <title>Creating multiple commands within Label Expression - Python</title>
      <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199840#M15353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a Python expression for my labels to create a set of multiple lines displaying various field of my attribute table (accomplished), and to make sure that one of the fields that I include has a command to only capitalize the first letter of the word.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;def FindLabel ( [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_N] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_M] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VITICULTUR] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_PLANT] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.ACRES] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VineRow] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.TRELLIS] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.DIRECT] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.RTSTLK]&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; return " " + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_N] + ' ' +&amp;nbsp; '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_M] + '\n' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VITICULTUR] + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_PLANT] +&amp;nbsp; '\n' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.ACRES] + ' ' + 'acres' + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VineRow] +&amp;nbsp; '\n' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.TRELLIS] + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.DIRECT] + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.RTSTLK]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; S = [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VITICULTUR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; S = S.title() &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; return S&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ex.JPG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/75880_ex.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;The expression successfully created this. However, I want to make the "MERLOT" in the label into "Merlot"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;My questions are: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;1. How do you add multiple commands within an expression? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;2. Is there something you must include each time there is a new command? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Many thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2015 23:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199840#M15353</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-19T23:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple commands within Label Expression - Python</title>
      <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199841#M15354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am a VB guy learning Python..... so take that in stride.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will help if you used the editors code formatter to format your code.&amp;nbsp; Python indentations are critically important.&amp;nbsp; Looking at your code...the proper indentation is lost so I have no clue on what your doing....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I take it that you want to do multiple things at once ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def FindLabel([Field1],[Field2]....[FieldN]):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLabel = ""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLabel = [Field1] + " " + [Field2] + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLabel = myLabel + [Field3].title() + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = [Field5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [Field4] = "Something": #Capitalize first letter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLabel = myLabel + s.capitalize()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: #UpperCase the word(s)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLabel = myLabel + s.upper()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return myLabel
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps somewhat....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:58:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199841#M15354</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2021-12-11T09:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple commands within Label Expression - Python</title>
      <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199842#M15355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've read that the label expression python feature in ArcGIS does not require the same indentations as it does elsewhere. My code with those indentations of just two (like you see in the one I've pasted) works perfectly fine, up to the point of wanting to capitalize that specific attribute. Clearly the latter would not work because I simply just had not any clue of what to type &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 20:56:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199842#M15355</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-20T20:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple commands within Label Expression - Python</title>
      <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199843#M15356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So to sum this up, with the help of Ted Kowal, add &lt;STRONG&gt;.title() &lt;/STRONG&gt;at the end of your attribute that you wish to properly capitalize.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Easy &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 21:11:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199843#M15356</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-20T21:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple commands within Label Expression - Python</title>
      <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199844#M15357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You do not need to concatenate every character or word separately in a string.&amp;nbsp; You wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ ' ' + 'acres' + ' ' + '-' + ' ' +&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should have written:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ ' acres - ' +&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ ' ' +&amp;nbsp; '-' + ' ' + &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should have written:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ ' - ' + &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 21:14:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199844#M15357</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-03-20T21:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple commands within Label Expression - Python</title>
      <link>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199845#M15358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ha! Oops. The little things one doesn't realize. That will make it so much cleaner. Thank you, Richard!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 21:19:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-multiple-commands-within-label-expression/m-p/199845#M15358</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-20T21:19:37Z</dc:date>
    </item>
  </channel>
</rss>

