<?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 Using a variable to get the pageRow field value in a Map Series? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-a-variable-to-get-the-pagerow-field-value-in/m-p/1010248#M5330</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the snippet below you can see that I am calling&amp;nbsp; ms.pageRow.PageName to get the value for the field named "PageName" in my Index Layer. This is how all the sample code I have found does it. But, how can you do this using a string variable for the field name? For instance you want to pass in the field name as an argument to the script. I have tried getValue("PageName") like you see in the SDK documentation, but that does not work. Any ideas?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if not lyt.mapSeries is None:
  ms = lyt.mapSeries

if ms.enabled:
  for pageNum in range(1, ms.pageCount + 1):
    ms.currentPageNumber = pageNum
    page = ms.pageRow.PageName # &amp;lt;-- ??How to use a variable field name here??
    print(" - {0}".format(output_path + f"file_{page}.pdf"))
    lyt.exportToPDF(output_path + f"file{page}.pdf", resolution = 300)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2020 18:12:52 GMT</pubDate>
    <dc:creator>ArwenVaughan1</dc:creator>
    <dc:date>2020-12-16T18:12:52Z</dc:date>
    <item>
      <title>Using a variable to get the pageRow field value in a Map Series?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-a-variable-to-get-the-pagerow-field-value-in/m-p/1010248#M5330</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the snippet below you can see that I am calling&amp;nbsp; ms.pageRow.PageName to get the value for the field named "PageName" in my Index Layer. This is how all the sample code I have found does it. But, how can you do this using a string variable for the field name? For instance you want to pass in the field name as an argument to the script. I have tried getValue("PageName") like you see in the SDK documentation, but that does not work. Any ideas?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if not lyt.mapSeries is None:
  ms = lyt.mapSeries

if ms.enabled:
  for pageNum in range(1, ms.pageCount + 1):
    ms.currentPageNumber = pageNum
    page = ms.pageRow.PageName # &amp;lt;-- ??How to use a variable field name here??
    print(" - {0}".format(output_path + f"file_{page}.pdf"))
    lyt.exportToPDF(output_path + f"file{page}.pdf", resolution = 300)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 18:12:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-a-variable-to-get-the-pagerow-field-value-in/m-p/1010248#M5330</guid>
      <dc:creator>ArwenVaughan1</dc:creator>
      <dc:date>2020-12-16T18:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable to get the pageRow field value in a Map Series?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-a-variable-to-get-the-pagerow-field-value-in/m-p/1144636#M7126</link>
      <description>&lt;P&gt;Unfortunately, the ESRI docs are wrong.&amp;nbsp; MapSeries.pageRow doesn't return a Row object, but a pageRow object, which does not have the getValue method.&lt;/P&gt;&lt;P&gt;You can use Python's &lt;A href="https://docs.python.org/3/library/functions.html?highlight=getattr#getattr" target="_blank" rel="noopener"&gt;getattr method&lt;/A&gt; to return the value instead.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;page = getattr(ms.pageRow, ms.pageNameField.name)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 14:58:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-a-variable-to-get-the-pagerow-field-value-in/m-p/1144636#M7126</guid>
      <dc:creator>RianCrowley1</dc:creator>
      <dc:date>2022-02-16T14:58:00Z</dc:date>
    </item>
  </channel>
</rss>

