<?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 Arcpy Source layer not recognized in tableFrame element of ArcGIS Pro Layout in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-source-layer-not-recognized-in-tableframe/m-p/1223788#M65903</link>
    <description>&lt;P&gt;I created a map series layout in ArcGIS Pro, and try to update it from a Python toolbox, using &lt;A title="Cartographic Information Model (CIM)" href="https://pro.arcgis.com/fr/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_self"&gt;Cartographic Information Model (CIM)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Each time the toolbox is running, the layer used to display tableFrame in the layout is overwritten. As the link with the tableFrame is lost during the process, I loop in layout elements to find my tableFrame, get the URI (unique id) of the layer of interest and use it to set the tableFrame's mapMemberURI.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")

lyt = aprx.listLayouts('AinsiC_Paysage_Atlas_statsDynamiques_lots_v2')[0]

ms = lyt.mapSeries
mf = lyt.listElements('MAPFRAME_ELEMENT', 'Map Frame Series')[0]
mapSeriesLyr = mf.map.listLayers('Reserve_castor')[0]

m = aprx.listMaps("Map2")[0]

lyt_cim = lyt.getDefinition("V2") # Get the layout's CIM definition

for elm in lyt_cim.elements:
    if elm.name == "Type_subsistance":
        subsi = m.listLayers('Clip_Subsi_Dissolve1')[0]
        subsi_cim = subsi.getDefinition('V2')
        subsi_URI = subsi_cim.uRI
        elm.mapMemberURI = subsi_URI

lyt.setDefinition(lyt_cim)

# Force a refresh of the layout and its associated panes
lyt_cim = lyt.getDefinition('V2')
lyt.setDefinition(lyt_cim)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This last step shows no error, but the tableFrame doesn't appear and I can see in the element pane that no layer is selected in the Table parameter.&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;I noticed that when I select the table in the interface, and extract the URI from Python script, the URI is *'CIMPATH=map2/clip_subsi_dissolve1.json'*, but when I use the name of the layer to extract the URI, it is *'CIMPATH=map2/clip_subsi_dissolve12.json'*.&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 14:23:25 GMT</pubDate>
    <dc:creator>JulietteLapeyre</dc:creator>
    <dc:date>2022-10-20T14:23:25Z</dc:date>
    <item>
      <title>Arcpy Source layer not recognized in tableFrame element of ArcGIS Pro Layout</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-source-layer-not-recognized-in-tableframe/m-p/1223788#M65903</link>
      <description>&lt;P&gt;I created a map series layout in ArcGIS Pro, and try to update it from a Python toolbox, using &lt;A title="Cartographic Information Model (CIM)" href="https://pro.arcgis.com/fr/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_self"&gt;Cartographic Information Model (CIM)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Each time the toolbox is running, the layer used to display tableFrame in the layout is overwritten. As the link with the tableFrame is lost during the process, I loop in layout elements to find my tableFrame, get the URI (unique id) of the layer of interest and use it to set the tableFrame's mapMemberURI.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")

lyt = aprx.listLayouts('AinsiC_Paysage_Atlas_statsDynamiques_lots_v2')[0]

ms = lyt.mapSeries
mf = lyt.listElements('MAPFRAME_ELEMENT', 'Map Frame Series')[0]
mapSeriesLyr = mf.map.listLayers('Reserve_castor')[0]

m = aprx.listMaps("Map2")[0]

lyt_cim = lyt.getDefinition("V2") # Get the layout's CIM definition

for elm in lyt_cim.elements:
    if elm.name == "Type_subsistance":
        subsi = m.listLayers('Clip_Subsi_Dissolve1')[0]
        subsi_cim = subsi.getDefinition('V2')
        subsi_URI = subsi_cim.uRI
        elm.mapMemberURI = subsi_URI

lyt.setDefinition(lyt_cim)

# Force a refresh of the layout and its associated panes
lyt_cim = lyt.getDefinition('V2')
lyt.setDefinition(lyt_cim)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This last step shows no error, but the tableFrame doesn't appear and I can see in the element pane that no layer is selected in the Table parameter.&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;I noticed that when I select the table in the interface, and extract the URI from Python script, the URI is *'CIMPATH=map2/clip_subsi_dissolve1.json'*, but when I use the name of the layer to extract the URI, it is *'CIMPATH=map2/clip_subsi_dissolve12.json'*.&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 14:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-source-layer-not-recognized-in-tableframe/m-p/1223788#M65903</guid>
      <dc:creator>JulietteLapeyre</dc:creator>
      <dc:date>2022-10-20T14:23:25Z</dc:date>
    </item>
  </channel>
</rss>

