<?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 Return character string from dynamic text? in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/return-character-string-from-dynamic-text/m-p/34720#M487</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to use to dynamic text to return a number of characters from a different dynamic text string in the same map document?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example the title of my mxd might be 00051_BaseMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd like to return the first five characters of this string dynamically so that I could have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;File Name: 00051_BaseMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Project Number: 00051&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ie the project number is drawn out of the file name dynamic text string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 May 2014 00:43:42 GMT</pubDate>
    <dc:creator>JamesPaull</dc:creator>
    <dc:date>2014-05-23T00:43:42Z</dc:date>
    <item>
      <title>Return character string from dynamic text?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/return-character-string-from-dynamic-text/m-p/34720#M487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to use to dynamic text to return a number of characters from a different dynamic text string in the same map document?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example the title of my mxd might be 00051_BaseMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd like to return the first five characters of this string dynamically so that I could have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;File Name: 00051_BaseMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Project Number: 00051&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ie the project number is drawn out of the file name dynamic text string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 May 2014 00:43:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/return-character-string-from-dynamic-text/m-p/34720#M487</guid>
      <dc:creator>JamesPaull</dc:creator>
      <dc:date>2014-05-23T00:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Return character string from dynamic text?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/return-character-string-from-dynamic-text/m-p/34721#M488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I do not see a way to do it within the text box.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You could give the text element a name, and then access that text element within a python script and change it with string / list functions. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use the following snippet to alter&amp;nbsp; a text element in my layout view:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for el in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT","SSPA_Tag"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ToPoint = string.find(el.text,"_",5)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.text = "SSPA_" + bkmk.name + "_" + ChemName + "_" + Today.strftime("%m/%d/%Y")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OutText = el.text&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could similarly use el.txt = el.text[:5] to return the first 5 characters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:21:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/return-character-string-from-dynamic-text/m-p/34721#M488</guid>
      <dc:creator>JimCousins</dc:creator>
      <dc:date>2021-12-10T21:21:05Z</dc:date>
    </item>
  </channel>
</rss>

