<?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: Stacking labels with Python code in ArcGIS in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355948#M27980</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander, I am in advanced editor. &lt;/P&gt;&lt;P&gt;How come you wouldn't recomment it? Do you think that is what is causing the error message?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the multiple field help, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Mar 2015 18:41:18 GMT</pubDate>
    <dc:creator>MaeganSalinas</dc:creator>
    <dc:date>2015-03-17T18:41:18Z</dc:date>
    <item>
      <title>Stacking labels with Python code in ArcGIS</title>
      <link>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355946#M27978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 12pt;"&gt;What I'm Trying To Do:&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;To begin, I am very, VERY, new to Python and can't wrap my head around scripting. So I need all the help I can get. Bear with me, please. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I am intending to use four fields as a stacked label for each polygon in the shapefile. I want them to look like this: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;IMG __jive_id="75077" alt="LayerGoal.JPG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/75077_LayerGoal.JPG" style="margin-right: auto; margin-left: auto; display: block;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;What I have: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So far I have two of the four fields prepared. I wanted to make sure that I could successfully stack at least two fields before going on and finalizing the other two. Wouldn't want to do all that work just to be told I have to redo it. So in the example, I will provide the two attribute fields that I have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CV_Ranches_Table_ArcGIS.txt.First&lt;/P&gt;&lt;P&gt;CV_Ranches_Table_ArcGIS.txt.Second&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First representing what I want for the first line, second representing the second.&lt;/P&gt;&lt;P&gt;I am aware that this discussion title is only reworded a bit in the ArcGIS Help 10.2 seen here: &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s800000027000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s800000027000000"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;"&lt;EM&gt;Create stacked text. For example, this expression creates a label with the Name field and the two address fields all on separate lines&lt;/EM&gt;:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;&lt;CODE&gt;"Name: " + [NAME] + '\n' + [ADDRESS_1] + '\n' + [ADDRESS_2]&lt;/CODE&gt;&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I'm exactly looking for! To stack multiple attribute fields into one label. In Label Expression, I attempted to copy and paste this code into my expression dialogue window. With my code looking like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;def FindLabel ( [CV_Ranches_Table_ArcGIS.txt.First], [CV_Ranches_Table_ArcGIS.txt.Second] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; return [CV_Ranches_Table_ArcGIS.txt.First] [CV_Ranches_Table_ArcGIS.txt.Second]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;"Nam&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;e:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; +&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; [CV_Ran&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;ches_Table_ArcGIS.txt.First]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; +&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; '\n'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;+&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt; [CV_Ranches_Table_ArcGIS.txt.Secon&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;d]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;After selecting the first and second attribute fields, it automatically added the "def FindLabel" code so I kept it thinking this was standard beginning for all codes...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I receive an error message each time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;What I'm Receiving: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="75080" alt="Error.JPG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/75080_Error.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the words of a very, most surely, well-known Beatles' song... "HELP. I need somebody."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Also....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is there are a way to make multiple, individual fields on the same line? (If I decide to create different excel cells for the remainder of attributes I have yet to create. This would make it faster, I think. As far as inputting them in the spread sheet, anyway.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 18:04:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355946#M27978</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-17T18:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking labels with Python code in ArcGIS</title>
      <link>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355947#M27979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It should be possible to label the attributes without the need to switch on the advanced editor:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LabelsFromCSV.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/75089_LabelsFromCSV.png" style="width: 620px; height: 462px;" /&gt;&lt;/P&gt;&lt;P&gt;although I would not recommend using labels based on joined text file...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To concatenate multiple field you can just add them together with for instances spaces ( + " " +) instead of using a new line (+ "\n" +).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 18:30:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355947#M27979</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-03-17T18:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking labels with Python code in ArcGIS</title>
      <link>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355948#M27980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander, I am in advanced editor. &lt;/P&gt;&lt;P&gt;How come you wouldn't recomment it? Do you think that is what is causing the error message?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the multiple field help, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 18:41:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355948#M27980</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-17T18:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking labels with Python code in ArcGIS</title>
      <link>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355949#M27981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's hard to tell exactly what your final code block was (not sure if you had the important keyword 'return' in there), but this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;STRONG style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;def FindLabel ( [CV_Ranches_Table_ArcGIS.txt.First], [CV_Ranches_Table_ArcGIS.txt.Second] ):&lt;/STRONG&gt;
&lt;STRONG style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; return &lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;"Nam&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;e:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; +&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; [CV_Ran&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;ches_Table_ArcGIS.txt.First]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; +&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; '\n'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;+&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt; [CV_Ranches_Table_ArcGIS.txt.Secon&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;d]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least, that type of syntax works for simple field names, not sure about field names with '.' (honestly, I didn't know that was possible).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:39:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355949#M27981</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T16:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking labels with Python code in ArcGIS</title>
      <link>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355950#M27982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome! It worked. Thank you so much, Darren &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 18:45:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stacking-labels-with-python-code-in-arcgis/m-p/355950#M27982</guid>
      <dc:creator>MaeganSalinas</dc:creator>
      <dc:date>2015-03-17T18:45:47Z</dc:date>
    </item>
  </channel>
</rss>

