<?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: How to programmatically enable &amp;quot;Page Query&amp;quot; (Map Series) on Annotation Layers? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675841#M101024</link>
    <description>&lt;P&gt;Yes, I use tis script with Gemini to make it works with my main script.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jan 2026 13:13:19 GMT</pubDate>
    <dc:creator>MarcelSt-Germain</dc:creator>
    <dc:date>2026-01-05T13:13:19Z</dc:date>
    <item>
      <title>How to programmatically enable "Page Query" (Map Series) on Annotation Layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675287#M100972</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;I am writing a Python script in ArcGIS Pro to automate the generation of annotations using the Tiled Labels To Annotation tool. The generation part works perfectly.&lt;/P&gt;&lt;P&gt;However, I am stuck on the final step. I have hundreds of resulting annotation layers, and I need to programmatically enable the Page Query property (found in Layer Properties &amp;gt; Page Query) for each of them.&lt;/P&gt;&lt;P&gt;The Goal: I need the script to:&lt;/P&gt;&lt;P&gt;Enable the Page Query (Filter based on Map Series).&lt;/P&gt;&lt;P&gt;Set the matching field to "TileID".&lt;/P&gt;&lt;P&gt;The Issue: I cannot find the correct ArcPy method or the valid CIM path to toggle this specific setting. I attempted to modify the layer definition using lyr.getDefinition('V3') by looking for pageDefinition or CIMPageDefinition, but the changes do not persist or the property seems inaccessible for these specific annotation layers.&lt;/P&gt;&lt;P&gt;Does anyone have a working code snippet (CIM or ArcPy) to enable the Page Query and set the field name?&lt;/P&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;ArcGIS Pro 3.x&lt;/P&gt;&lt;P&gt;Python 3&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2025 15:54:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675287#M100972</guid>
      <dc:creator>MarcelSt-Germain</dc:creator>
      <dc:date>2025-12-30T15:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically enable "Page Query" (Map Series) on Annotation Layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675294#M100974</link>
      <description>&lt;P&gt;Yes — you don’t need CIM for this in Pro 3.x. arcpy.mp.Layer has a native method called setPageQuery() that toggles Layer Properties → Page Query and sets the matching field in one shot&lt;BR /&gt;&lt;BR /&gt;A working pattern looks like this (run in the Pro Python window / as a script tool in the same project):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

TILE_FIELD = "TileID"   # field in each annotation feature class/layer
MATCH = True            # True = match current page name, False = inverse

aprx = arcpy.mp.ArcGISProject("CURRENT")

for lyt in aprx.listLayouts():
    ms = getattr(lyt, "mapSeries", None)
    if not ms or not ms.enabled:
        continue

    # Page Query only applies to layers in the MapFrame used by the Map Series
    mf = ms.mapFrame
    m = mf.map

    updated = 0
    failed = 0

    for lyr in m.listLayers():
        # Annotation layers are feature layers in most projects; keep this filter simple and safe
        if not lyr.isFeatureLayer:
            continue

        try:
            # Enable Page Query + set matching field
            lyr.setPageQuery(TILE_FIELD, MATCH)  # &amp;lt;-- the key call
            updated += 1
        except Exception as ex:
            failed += 1
            arcpy.AddWarning(f"Skipped: {lyr.longName} | {ex}")

    arcpy.AddMessage(f"[{lyt.name}] Page Query set on {updated} layers (failed: {failed}).")

aprx.save()&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;A couple of “gotchas” (these bite everyone)&lt;BR /&gt;Page Query is only honored when the layer is inside the MapFrame that your Map Series references. If you’re updating layers in a different map/frame, nothing will appear to happen even though the property is set.&lt;/P&gt;&lt;P&gt;setPageQuery() expects the field in the layer whose values match the Map Series page name field (from the index layer). So your TileID strategy works best when your Map Series “Name Field” is also effectively TileID (or produces the same values).&lt;/P&gt;&lt;P&gt;You can verify what’s currently set using lyr.pageQuery (it returns a tuple with fieldName and match).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2025 16:42:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675294#M100974</guid>
      <dc:creator>VenkataKondepati</dc:creator>
      <dc:date>2025-12-30T16:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically enable "Page Query" (Map Series) on Annotation Layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675453#M100988</link>
      <description>&lt;P&gt;Thanks, I will try it later.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Dec 2025 16:24:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675453#M100988</guid>
      <dc:creator>MarcelSt-Germain</dc:creator>
      <dc:date>2025-12-31T16:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically enable "Page Query" (Map Series) on Annotation Layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675465#M100990</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/361828"&gt;@MarcelSt-Germain&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Did you accept my response as a solution or something else?&lt;BR /&gt;I don't see any other reply to this post. If my response helped you or planning to try later, please accept my reply as a solution.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;Venkat&lt;/P&gt;</description>
      <pubDate>Wed, 31 Dec 2025 17:38:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675465#M100990</guid>
      <dc:creator>VenkataKondepati</dc:creator>
      <dc:date>2025-12-31T17:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically enable "Page Query" (Map Series) on Annotation Layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675841#M101024</link>
      <description>&lt;P&gt;Yes, I use tis script with Gemini to make it works with my main script.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 13:13:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-programmatically-enable-quot-page-query/m-p/1675841#M101024</guid>
      <dc:creator>MarcelSt-Germain</dc:creator>
      <dc:date>2026-01-05T13:13:19Z</dc:date>
    </item>
  </channel>
</rss>

