<?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.RefreshActiveView in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477183#M37353</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Dan, silly error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am struggling to get the script to run and the problem seems to lay in my query and Search Cursor. It is giving me an error which says&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "D:\Profiles\jByrne\Documents\DARD GIS\TEST SCRIPT\GridMon16_help.py", line 13, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FP_sampleRows=arcpy.SearchCursor(GridTable.datasource, queryExp)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'TextElement' object has no attribute 'datasource'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have attached my code as well. I am running out of ideas and because I don't know it very well (started scripting friday!) I can't really see the wood for the trees.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd=arcpy.mapping.MapDocument("current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BUSID_TEMP=arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LayersDF=arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;selLyr=arcpy.mapping.ListLayers(mxd, "FP_sample", LayersDF)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for elm in arcpy.mapping.ListLayoutElements(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if elm.name=="GridTable": GridTable = elm&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp=mxd.dataDrivenPages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage(BUSID_TEMP)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pageID=mxd.dataDrivenPages.getPageIDFromName(str(BUSID_TEMP))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID=pageID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;queryExp="\"BUSID_TEMP\"='"+BUSID_TEMP+"'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FP_sampleRows=arcpy.SearchCursor(GridTable.datasource, queryExp)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;revTable=arcpy.mapping.ListTableViews(mxd,"GridTable")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage("Process Completed")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Jun 2014 12:09:54 GMT</pubDate>
    <dc:creator>JohnByrne</dc:creator>
    <dc:date>2014-06-16T12:09:54Z</dc:date>
    <item>
      <title>arcpy.RefreshActiveView</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477181#M37351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Morning all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to put together a script that automatically updates the active table in Data Driven Pages. I found the script from one of the user groups on here and I think I have managed to alter the script but there is showing an error in line 39 and line 40&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage("Process Completed")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure what to do to fix this as I am only learning python and scripting. I have attached a jpeg of the code in case it helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 07:26:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477181#M37351</guid>
      <dc:creator>JohnByrne</dc:creator>
      <dc:date>2014-06-16T07:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.RefreshActiveView</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477182#M37352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are missing the closing bracket&amp;nbsp; )&amp;nbsp; in the line above hence it is erroring out&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 10:11:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477182#M37352</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-06-16T10:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.RefreshActiveView</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477183#M37353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Dan, silly error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am struggling to get the script to run and the problem seems to lay in my query and Search Cursor. It is giving me an error which says&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "D:\Profiles\jByrne\Documents\DARD GIS\TEST SCRIPT\GridMon16_help.py", line 13, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FP_sampleRows=arcpy.SearchCursor(GridTable.datasource, queryExp)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'TextElement' object has no attribute 'datasource'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have attached my code as well. I am running out of ideas and because I don't know it very well (started scripting friday!) I can't really see the wood for the trees.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd=arcpy.mapping.MapDocument("current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BUSID_TEMP=arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LayersDF=arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;selLyr=arcpy.mapping.ListLayers(mxd, "FP_sample", LayersDF)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for elm in arcpy.mapping.ListLayoutElements(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if elm.name=="GridTable": GridTable = elm&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp=mxd.dataDrivenPages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage(BUSID_TEMP)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pageID=mxd.dataDrivenPages.getPageIDFromName(str(BUSID_TEMP))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID=pageID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;queryExp="\"BUSID_TEMP\"='"+BUSID_TEMP+"'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FP_sampleRows=arcpy.SearchCursor(GridTable.datasource, queryExp)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;revTable=arcpy.mapping.ListTableViews(mxd,"GridTable")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage("Process Completed")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 12:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477183#M37353</guid>
      <dc:creator>JohnByrne</dc:creator>
      <dc:date>2014-06-16T12:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.RefreshActiveView</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477184#M37354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/38353"&gt;John Byrne&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;It looks like the datasource attribute is not a property of that element.&amp;nbsp; I would recommend looking at the following documentation (&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/ListLayoutElements/00s30000003w000000/" title="http://resources.arcgis.com/en/help/main/10.2/index.html#/ListLayoutElements/00s30000003w000000/"&gt;ListLayoutElements (arcpy.mapping)&lt;/A&gt;) which can provide some insight into what each elements properties are.&amp;nbsp; The traceback error, which has the message: &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;AttributeError: 'TextElement' object has no attribute 'datasource', lets us know that it is an issue with an attribute associated with a TextElement.&amp;nbsp; So we can look at our TextElement page and see that datasource is not an attribute of the textelements. &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/TextElement/00s30000000m000000/" style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; line-height: 1.5;" title="http://resources.arcgis.com/en/help/main/10.2/index.html#/TextElement/00s30000000m000000/"&gt;Text Element (arcpy.mapping)&lt;/A&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; line-height: 1.5;"&gt;‌&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; line-height: 1.5;"&gt;Does this help?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2014 21:46:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-refreshactiveview/m-p/477184#M37354</guid>
      <dc:creator>AlexanderNohe1</dc:creator>
      <dc:date>2014-07-14T21:46:48Z</dc:date>
    </item>
  </channel>
</rss>

