<?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: Dynamic Text in Layout in ArcGIS Pro in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1167520#M54397</link>
    <description>&lt;P&gt;Thank you very much for your response. Yes, I want the text to appear in a static location on the layout. But, I don't completely understand, where I will incorporate this Python script you provided me. Would it be in the Printing tool Python script? I'm sorry, I'm just unsure what the workflow is to incorporate this script.&lt;/P&gt;&lt;P&gt;Any explanation would be appreciated!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2022 14:51:11 GMT</pubDate>
    <dc:creator>DanaNajeeb</dc:creator>
    <dc:date>2022-04-25T14:51:11Z</dc:date>
    <item>
      <title>Dynamic Text in Layout in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1166572#M54289</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a custom print service that prints only the selected polygon in Portal for ArcGIS's Web AppBuilder.&lt;/P&gt;&lt;P&gt;I want it to print a custom layout that has a dynamic text that only prints the value of the attribute of the selected feature. Meaning, for example, if I selected a polygon where the value of its OBJECTID is 3, I want the text to read "OBJECTID: 3", if I select another one, it gives another value, etc...&lt;/P&gt;&lt;P&gt;I'm using ArcGIS Pro to create the layout.&lt;/P&gt;&lt;P&gt;Any tips would be appreciated!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 11:47:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1166572#M54289</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-04-21T11:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Text in Layout in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1167050#M54342</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/529827"&gt;@DanaNajeeb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want the text to appear 1) in a static location on the layout OR 2) as a label in the map as if you were labeling only selected features?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a solution for #1.&amp;nbsp; It first ensures there is only 1 selected feature. You may have a different scenario.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
l = m.listLayers('GreatLakes')[0]

#Ensure one feature is selected, then get value
numRows = int(arcpy.GetCount_management(l).getOutput(0))
if numRows == 1:
    table = arcpy.SearchCursor(l, ['OBJECTID'])
    for row in table:
        value = row.getValue('OBJECTID')
else:
    exit

#Reference layout and set text value
lyt = p.listLayouts()[0]
t = lyt.listElements('TEXT_ELEMENT', "MyText")[0]
t.text = value&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Depending on the details, for #2 an easier route might be to have a secondary layer for labeling and then apply a def query to that layer to match the selected features.&amp;nbsp; I guess this only works if a def query was used to create the selection in the first place.&amp;nbsp; Devil is in the details.&lt;/P&gt;&lt;P&gt;Jeff - Layout and arcpy.mp Teams&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is code that will work with the easier scenario: static text location on a layout.&amp;nbsp; I first ensure there is only one selected feature.&amp;nbsp; Devil is in the details.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 15:15:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1167050#M54342</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2022-04-22T15:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Text in Layout in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1167520#M54397</link>
      <description>&lt;P&gt;Thank you very much for your response. Yes, I want the text to appear in a static location on the layout. But, I don't completely understand, where I will incorporate this Python script you provided me. Would it be in the Printing tool Python script? I'm sorry, I'm just unsure what the workflow is to incorporate this script.&lt;/P&gt;&lt;P&gt;Any explanation would be appreciated!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 14:51:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dynamic-text-in-layout-in-arcgis-pro/m-p/1167520#M54397</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-04-25T14:51:11Z</dc:date>
    </item>
  </channel>
</rss>

