<?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: Bold text element fails if there is a &amp; symbol in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39446#M3141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the tip!&amp;nbsp; This is exactly what I will do, if I do not find a way to do it without replacing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Aug 2015 14:58:00 GMT</pubDate>
    <dc:creator>deleted-user-MS0lE1F_0-sy</dc:creator>
    <dc:date>2015-08-05T14:58:00Z</dc:date>
    <item>
      <title>Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39440#M3135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I have a massive amount of data I need to get into a text element, so I wrote a python script for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;textValue += "&amp;lt;BOL&amp;gt;" + row[0] + ": &amp;lt;/BOL&amp;gt;" +&amp;nbsp; row[1]&amp;nbsp; + " - " + row[2] + '\r\n'
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;001:&lt;/STRONG&gt; John Doe - 12345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;002:&lt;/STRONG&gt; Jane Smith - 67890&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem happens when a "&amp;amp;" symbol is introduced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;BOL&amp;gt;001:&amp;lt;/BOL&amp;gt; John Doe - 12345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;BOL&amp;gt;002:&amp;lt;/BOL&amp;gt; Jeff &amp;amp; Jane Smith - 67890&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get that this is a formatting rule issue, but is there away I can get around this.&amp;nbsp;&amp;nbsp; I guess I could write a script to replace all “&amp;amp;” with “and” but I prefer not to.&amp;nbsp; I appreciate any suggestions. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:32:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39440#M3135</guid>
      <dc:creator>deleted-user-MS0lE1F_0-sy</dc:creator>
      <dc:date>2021-12-10T21:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39441#M3136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried using ascii symbol value ...&amp;nbsp; chr(38)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 14:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39441#M3136</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2015-08-05T14:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39442#M3137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the confusion, it is not because I want the symbol, it is just that the symbol is already there in a lot of the attributes that I am trying to write to a text element. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 14:21:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39442#M3137</guid>
      <dc:creator>deleted-user-MS0lE1F_0-sy</dc:creator>
      <dc:date>2015-08-05T14:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39443#M3138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So what happens when you encounter the "&amp;amp;"? Is it a run-time error or a formatting error?&amp;nbsp; Since the character is already in the data the only thing I can think of is replacing it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 14:37:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39443#M3138</guid>
      <dc:creator>AnthonyAtkins1</dc:creator>
      <dc:date>2015-08-05T14:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39444#M3139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It still runs fine, but the results of my list in the text element are &amp;lt;BOL&amp;gt;002:&amp;lt;/BOL&amp;gt; Jeff &amp;amp; Jane Smith - 67890 instead of &lt;STRONG&gt;002:&lt;/STRONG&gt; Jeff &amp;amp; Jane Smith - 67890.&amp;nbsp; If there just 1 row that has the "&amp;amp;" the whole list will look like &amp;lt;BOL&amp;gt;002:&amp;lt;/BOL&amp;gt; Jeff &amp;amp; Jane Smith - 67890.&amp;nbsp;&amp;nbsp; It ignores the bold formatting altogether.&amp;nbsp; I think you are right I might have to just replace them, was hoping someone ran into this type a thing before and had a work around.&amp;nbsp; Thanks for the reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 14:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39444#M3139</guid>
      <dc:creator>deleted-user-MS0lE1F_0-sy</dc:creator>
      <dc:date>2015-08-05T14:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39445#M3140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of replacing with and, you can replace with it with "&lt;SPAN class="usertext"&gt;&amp;amp;amp;", which is read by the text formatter as an ampersand.&amp;nbsp; I made a duplicate field in my attribute table and replaced my "&amp;amp;" with "&amp;amp;amp;" and it labelled properly off the copy field.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="usertext"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="usertext"&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Using_text_formatting_tags/00s80000000p000000/" title="http://resources.arcgis.com/en/help/main/10.2/index.html#/Using_text_formatting_tags/00s80000000p000000/"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 14:50:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39445#M3140</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-08-05T14:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39446#M3141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the tip!&amp;nbsp; This is exactly what I will do, if I do not find a way to do it without replacing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 14:58:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39446#M3141</guid>
      <dc:creator>deleted-user-MS0lE1F_0-sy</dc:creator>
      <dc:date>2015-08-05T14:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Bold text element fails if there is a &amp; symbol</title>
      <link>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39447#M3142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;further testing, you don't need to make a new field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I replaced the value in the label expression then added it to the expression I wanted returned and it worked perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def FindLabel ([Test]):
&amp;nbsp; label = [Test].replace("&amp;amp;" , "&amp;amp;amp;")
&amp;nbsp; return "&amp;lt;BOL&amp;gt;" + label + "&amp;lt;/BOL&amp;gt;"&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This worked for a text field that had an ampersand on it.&amp;nbsp; John &amp;amp; Jim displayed correctly on a point with this expression.&amp;nbsp; Also I explored python string formatting and nothing worked on that front.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:32:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bold-text-element-fails-if-there-is-a-symbol/m-p/39447#M3142</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-10T21:32:09Z</dc:date>
    </item>
  </channel>
</rss>

