<?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: Arcpy.mp Map Series- Field Name from code in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605350#M26871</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had this same question and got it to work using the&amp;nbsp;&lt;A href="https://docs.python.org/3/library/functions.html#getattr" rel="nofollow noopener noreferrer" target="_blank"&gt;getattr()&lt;/A&gt;&amp;nbsp;function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;enabled&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    name_field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageNameField&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; pageNum &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageCount &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;currentPageNumber &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pageNum
        pageName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; getattr&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageRow&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; name_field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 01:57:21 GMT</pubDate>
    <dc:creator>StephenM</dc:creator>
    <dc:date>2021-12-12T01:57:21Z</dc:date>
    <item>
      <title>Arcpy.mp Map Series- Field Name from code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605346#M26867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use the arcpy MapSeries Class to generate PNGs for each sheet,&amp;nbsp;based on Code Example #2 here:&amp;nbsp;&lt;A class="jivelink1" href="http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm#C_GUID-5F34FFE0-FC62-481E-B960-A7D0554B7800" title="http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm#C_GUID-5F34FFE0-FC62-481E-B960-A7D0554B7800"&gt;http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm#C_GUID-5F34FFE0-FC62-481E-B960-A7D0554B7800&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to get the Index field name from the Map Series Index Layer to make the code flexible rather than having to hard-code in the field name in the pageRow property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My attempts don't work, although it's easy enough to find the&amp;nbsp;&amp;nbsp;I can't figure out how to pass a variable into the FIELD_NAME portion of the pageRow property.&lt;/P&gt;&lt;P&gt;using either&amp;nbsp; &lt;EM&gt;pageField = ms.pageNameField.name&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;or&amp;nbsp; &lt;EM&gt;pageField = str(ms.pageNameField.name)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;fails on:&amp;nbsp;&amp;nbsp;&lt;EM&gt;pageName = ms.pageRow.pageField&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;with: &lt;EM&gt;AttributeError: 'pageRow' object has no attribute 'pageField'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Is there any way to insert a variable into the Field Name attribute?&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;layout.MapSeries.pageRow.&lt;STRONG&gt;FIELD_NAME&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;#get parameters&lt;BR /&gt;SaveLocation = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;l = aprx.listLayouts()[0]&lt;BR /&gt;if not l.mapSeries is None:&lt;BR /&gt;&amp;nbsp; ms = l.mapSeries&lt;BR /&gt;&amp;nbsp; if ms.enabled:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for pageNum in range(1, ms.pageCount + 1):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ms.currentPageNumber = pageNum&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; pageField = ms.pageNameField.name&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; pageName = ms.pageRow.pageField&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; l.exportToPNG(SaveLocation + "\\" + pageName + ".png")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:33:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605346#M26867</guid>
      <dc:creator>AaronWorthley1</dc:creator>
      <dc:date>2018-08-28T14:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.mp Map Series- Field Name from code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605347#M26868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm"&gt;MapSeries—ArcPy | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In their examples they hardcode the page name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f8f8; color: #595959; font-family: 'Consolas','Andale Mono','Lucida Console','Monaco',monospace; font-size: 14.46px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; word-wrap: normal;"&gt;pageName = ms.pageRow.STATE_NAME &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately they give no indication as to whether the actual example's field name is in all caps or not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;They have an example of using a pagenumber.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is also a pagename field property and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 14.8px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;getPageNumberFromName (page_name)&lt;/SPAN&gt; method that might make it easier&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:07:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605347#M26868</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-28T15:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.mp Map Series- Field Name from code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605348#M26869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right, and I have no problem when I hard-code in my own field name&lt;/P&gt;&lt;P&gt;ie. pageName = ms.pageRow.MyFieldName&lt;/P&gt;&lt;P&gt;but I want to substitute MyFieldName with the active Field Name from the code so I don't have to change it every time....I can easily get that field name using this:&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;ms.pageNameField.name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;but can't figure out how to get it into the Field Name&amp;nbsp;part of the pageRow property.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:13:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605348#M26869</guid>
      <dc:creator>AaronWorthley1</dc:creator>
      <dc:date>2018-08-28T15:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.mp Map Series- Field Name from code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605349#M26870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It don't think it is possible to concatenate/append the property to the object&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:28:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605349#M26870</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-28T15:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.mp Map Series- Field Name from code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605350#M26871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had this same question and got it to work using the&amp;nbsp;&lt;A href="https://docs.python.org/3/library/functions.html#getattr" rel="nofollow noopener noreferrer" target="_blank"&gt;getattr()&lt;/A&gt;&amp;nbsp;function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;enabled&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    name_field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageNameField&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; pageNum &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageCount &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;currentPageNumber &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pageNum
        pageName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; getattr&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageRow&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; name_field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:57:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605350#M26871</guid>
      <dc:creator>StephenM</dc:creator>
      <dc:date>2021-12-12T01:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy.mp Map Series- Field Name from code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605351#M26872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Worked great, Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:31:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-map-series-field-name-from-code/m-p/605351#M26872</guid>
      <dc:creator>AaronWorthley1</dc:creator>
      <dc:date>2019-06-28T15:31:10Z</dc:date>
    </item>
  </channel>
</rss>

