<?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: Likely Simple Python Question: dynamically selecting records in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763226#M58970</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Katie, have you made any progress with this yet?&amp;nbsp; It's an interesting problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure how much (or how little, as you say) experience at this point in time with arcpy -- maybe you've been experimenting since your last post?&amp;nbsp; I took a cursory look at the sample provided by the MapAutomationTeam -- sometimes the best way to get started is to look at script samples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script they provided is very short - again not sure how familiar you are right now, particularly pertaining to DDP, but the team is leveraging the 'pagerow' property get, see the webhelp at this link pertaining to DDP and see where 'pagerow' is listed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DataDrivenPages (arcpy.mapping)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop » Geoprocessing » ArcPy » Mapping module&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s300000030000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//00s300000030000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using this read-only property, you can "...return the index layer's row object for the active or current page." ---- so that 'row' obj would be returned something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# your map obj, based on an input pathname:
mxd = arcpy.mapping.MapDocument(r'your mxd pathname goes here')

# fetching the row obj of your current DDP index page:
currentRow = mxd.dataDrivenPages.pageRow
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...but why you'd be interested in the current index page's row object is to get at one of the field values, say if there's a field called Station_ID - then fetch that value like so (continued from the code above):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
currentStation = currentRow.Station_ID
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Similarly, if this makes sense from the webhelp Code section (from the webhelp link provided above; scroll to the bottom of the page), see the 2nd sample (DataDrivenPages example 2) and see where the line performing the same function to fetch a desired field value from the current index page row - it's shortened a bit by combining on a single line part of that already shown above:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# 'TSR' is the fieldname the value is fetched from in this case
fieldValue = mxd.dataDrivenPages.pageRow.TSR
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...so I'm going to make a slight jump here to the MapAutomationTeam code sample, if you've downloaded that.&amp;nbsp; See the section of code, called 'Modify bar chart', in the script the team provides (StandAlone_FullMapSeries.py) - it's pasted here (I added one comment to separate the 2 graphic elements being modified):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Modify bar chart
his2000 = float(mxd.dataDrivenPages.pageRow.HisPer2000)
bar1.elementHeight = (his2000 / 50)*2
bar1txt.text = "(" + str(round(his2000, 2)) + ")"
bar1txt.elementPositionY = bar1.elementPositionY + bar1.elementHeight + 0.1

# comment I added:
# 2nd bar element modified, same line formatting as above 4 lines
his2010 = float(mxd.dataDrivenPages.pageRow.HisPer2010)
bar2.elementHeight = (his2010 / 50)*2
bar2txt.text = "(" + str(round(his2010, 2)) + ")"
bar2txt.elementPositionY = bar2.elementPositionY + bar2.elementHeight + 0.1
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code snippet uses pageRow to 'mine' the field 'HisPer2000' for every page and update, or in other words, dynamically create the bar chart for the current page...2 bars were modified based on the values found in the 2 fields, HisPer2000 and HisPer2010.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is the mechanism for controlling the graph...and that is within the looping block, if you understand that, set up by the statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#Loop through each DDP page
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make sense?...if may be a little daunting at 1st, but that's why you should probably post a small sample of your data and mxd, so you'll have a directly relevant demo you can then experiment directly with.&amp;nbsp; This is actually an invaluable device for including in any reports, etc., that your org requires...and why I am interested.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on your last response, which you posted before my current (last) post...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You do not need an add-in.&amp;nbsp; Likely, you'd just create either a script tool or a stand-alone script --- important thing to realize here is the script is 'dynamically' updating your graph by manipulating the elements based on the current page index values.&amp;nbsp; So as DDP is 'aware' of pages based on your index layer, the script 'links' the graph to those individual pages, so to speak, via 'looking up' values from the index page (the current row), modifying the graph accordingly, then exporting output...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 08:26:09 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2021-12-12T08:26:09Z</dc:date>
    <item>
      <title>Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763221#M58965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have a question that is likely very easily solved with some Python coding....I just have no experience in the area.&amp;nbsp; It was suggested in the General Forum that I post my question here.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to dynamically select records based on a field set in Data Driven Pages? I have a graph in my layout that I want to update with each scroll with each "Next Page".&amp;nbsp; I have a table set up with a page definition query for the data I want graphed. Unfortunately, the graph still plots all records, not just the ones displayed with the page definition query. So, for example, even though (with the page definition query) my table displays records only from Station_ID = 101, the graphs displays records from all Station_IDs. The graph only works properly (displaying only Station_ID = 101 items) if they are manually selected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there anyway to automate this? I'm guessing there's an easy Python code I could run to manage this....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance and please ask questions if I haven't made myself clear!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Katie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 20:05:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763221#M58965</guid>
      <dc:creator>KatieGaut1</dc:creator>
      <dc:date>2013-12-12T20:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763222#M58966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Any way you can post a small sample of your data, zip and attach here...maybe with some illustrative screen shots to help clarify your problem?&amp;nbsp; Not sure if it can be done with Python exactly but give us more to go on in order to confirm that conclusion.&amp;nbsp; Also, I don't think you said what version of ArcMap you're using?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran across this, haven't tested it out though:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DDPwithDynamicTablesAndGraphs_10.1_v1&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=3a525b986b774a3f9cbbd8daf2435852"&gt;http://www.arcgis.com/home/item.html?id=3a525b986b774a3f9cbbd8daf2435852&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 22:40:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763222#M58966</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-12-12T22:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763223#M58967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks so much for your reply Wayne.&amp;nbsp; I'm using ArcGIS 10.2 and here are some screen shots of the project.&amp;nbsp; The XYMin_Max_Avg_Temp_WithLatLong table is the data I am graphing on the chart (avg/min/max temperatures).&amp;nbsp; I have this table in a Page Definition Query based on the Station_Id.&amp;nbsp; As I move through the next page, it advances the Station_Id and the maps are updated based on the station locations.&amp;nbsp; The XY_Min_Max_Avg...table updates to the next Station_ID as well, but the temperatures do not graph.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;**Screen Shot of the project with Table**&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; In the graphing properties, I have the "Show only selected features/record on graph" selected.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;**Screen Shot of Graph Properties Page**&lt;/SPAN&gt;&lt;SPAN&gt;Unfortunately, even though the temperatures I want graphed are selected via the Page Definition, they apparently need to be selected via an actual 'selection' (via by attributes or other). &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt; **Screen Shot of Page Definition for XY_Min_Max_Temp...Table**&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; So....it seems to me that perhaps a python script could be developed that selected records in the XY_Min_Max_Temp...table based on the Station_ID selected in the current Data Driven Page.&amp;nbsp; Perhaps there is an easier solution (that would be amazing).&amp;nbsp; Please ask more questions if I've just muddied the water further.&amp;nbsp; Thanks so much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]29858[/ATTACH][ATTACH=CONFIG]29859[/ATTACH][ATTACH=CONFIG]29860[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 14:32:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763223#M58967</guid>
      <dc:creator>KatieGaut1</dc:creator>
      <dc:date>2013-12-13T14:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763224#M58968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Katie,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No sample data you can zip/attach?...I don't know if I'll have time to look at this further today, but the screenshots (which I haven't opened yet) should help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you look at the link from my last post -- looks like something for you to investigate and since you're at 10.2, you should be able to leverage the part about &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;'dynamic graphs&lt;/SPAN&gt;&lt;SPAN&gt; and tables'.&amp;nbsp; That was in their 1st bullet point (this was produced by the MapAutomationTeam, which I'm assuming is ESRI ?):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Arcpy.mapping now allows for cloning of text and graphic elements.&amp;nbsp; This makes it possible to generate truly dynamic tables and graphs."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't look yet at what the MapAutomationTeam provided either, but it looks promising....hope that helps, check it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 15:13:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763224#M58968</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-12-13T15:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763225#M58969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Wayne,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have opened and looked at the DDPwithDynamicTablesAndGraphs_10.1_v1 (by the MapAutomationTeam).&amp;nbsp; It's a great product....but far over my head as far as trying to interpret their coding, then adapting to my needs.&amp;nbsp; I've tried creating a Python add-in&amp;nbsp; toolbar/button that simply selects the records in the XY_Min_Max_Temp.... table.&amp;nbsp; So far, my toolbar shows up but the button says "Missing" so my code is obviously in error.&amp;nbsp;&amp;nbsp; Argh!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If some data would help I would gladly attach it, but I have so many layers I'm not sure what would be helpful to attach.&amp;nbsp; The screenshot in the last post showed the main table I am working with.&amp;nbsp; Thanks for your help and thoughts, Wayne.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Katie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 18:52:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763225#M58969</guid>
      <dc:creator>KatieGaut1</dc:creator>
      <dc:date>2013-12-13T18:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763226#M58970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Katie, have you made any progress with this yet?&amp;nbsp; It's an interesting problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure how much (or how little, as you say) experience at this point in time with arcpy -- maybe you've been experimenting since your last post?&amp;nbsp; I took a cursory look at the sample provided by the MapAutomationTeam -- sometimes the best way to get started is to look at script samples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script they provided is very short - again not sure how familiar you are right now, particularly pertaining to DDP, but the team is leveraging the 'pagerow' property get, see the webhelp at this link pertaining to DDP and see where 'pagerow' is listed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DataDrivenPages (arcpy.mapping)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop » Geoprocessing » ArcPy » Mapping module&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s300000030000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//00s300000030000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using this read-only property, you can "...return the index layer's row object for the active or current page." ---- so that 'row' obj would be returned something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# your map obj, based on an input pathname:
mxd = arcpy.mapping.MapDocument(r'your mxd pathname goes here')

# fetching the row obj of your current DDP index page:
currentRow = mxd.dataDrivenPages.pageRow
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...but why you'd be interested in the current index page's row object is to get at one of the field values, say if there's a field called Station_ID - then fetch that value like so (continued from the code above):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
currentStation = currentRow.Station_ID
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Similarly, if this makes sense from the webhelp Code section (from the webhelp link provided above; scroll to the bottom of the page), see the 2nd sample (DataDrivenPages example 2) and see where the line performing the same function to fetch a desired field value from the current index page row - it's shortened a bit by combining on a single line part of that already shown above:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# 'TSR' is the fieldname the value is fetched from in this case
fieldValue = mxd.dataDrivenPages.pageRow.TSR
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...so I'm going to make a slight jump here to the MapAutomationTeam code sample, if you've downloaded that.&amp;nbsp; See the section of code, called 'Modify bar chart', in the script the team provides (StandAlone_FullMapSeries.py) - it's pasted here (I added one comment to separate the 2 graphic elements being modified):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Modify bar chart
his2000 = float(mxd.dataDrivenPages.pageRow.HisPer2000)
bar1.elementHeight = (his2000 / 50)*2
bar1txt.text = "(" + str(round(his2000, 2)) + ")"
bar1txt.elementPositionY = bar1.elementPositionY + bar1.elementHeight + 0.1

# comment I added:
# 2nd bar element modified, same line formatting as above 4 lines
his2010 = float(mxd.dataDrivenPages.pageRow.HisPer2010)
bar2.elementHeight = (his2010 / 50)*2
bar2txt.text = "(" + str(round(his2010, 2)) + ")"
bar2txt.elementPositionY = bar2.elementPositionY + bar2.elementHeight + 0.1
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code snippet uses pageRow to 'mine' the field 'HisPer2000' for every page and update, or in other words, dynamically create the bar chart for the current page...2 bars were modified based on the values found in the 2 fields, HisPer2000 and HisPer2010.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is the mechanism for controlling the graph...and that is within the looping block, if you understand that, set up by the statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#Loop through each DDP page
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make sense?...if may be a little daunting at 1st, but that's why you should probably post a small sample of your data and mxd, so you'll have a directly relevant demo you can then experiment directly with.&amp;nbsp; This is actually an invaluable device for including in any reports, etc., that your org requires...and why I am interested.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on your last response, which you posted before my current (last) post...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You do not need an add-in.&amp;nbsp; Likely, you'd just create either a script tool or a stand-alone script --- important thing to realize here is the script is 'dynamically' updating your graph by manipulating the elements based on the current page index values.&amp;nbsp; So as DDP is 'aware' of pages based on your index layer, the script 'links' the graph to those individual pages, so to speak, via 'looking up' values from the index page (the current row), modifying the graph accordingly, then exporting output...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763226#M58970</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-12T08:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763227#M58971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Katie, are you still listening?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I looked at your pics again - I think I saw a clue in your very 1st screenshot.&amp;nbsp; All records were selected.&amp;nbsp; So it seems you need something to 'reselect' the records based on the page definition; this will potentially update the related graph (which may be easier than 'reconstructing' the elements as in the bar graph sample I was talking about in my last post).&amp;nbsp; Is that not what you were basically trying to tell me?&amp;nbsp; (See how dense I am without test data? lol!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure this is the best way, and I'd have to test with a sample I'll try to make up over the weekend (if I have time).&amp;nbsp; It seems the problem is the graph will update only based on a selection...it won't update based on the page def query alone, if you refresh the DDP?&amp;nbsp; Try that.&amp;nbsp; Otherwise, making sure the selected set is the same as that defined by the page def query may be the workaround - and that, as shown last post, can be based on the pageRow fetch on Station_ID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That helping any?&amp;nbsp; It's okay - we're pretty fortunate to have access to so many fine-tuning options via Python in order to produce many different kinds of output, amazing actually.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 20:39:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763227#M58971</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-12-13T20:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763228#M58972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Wayne,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I so greatly appreciate your help....but I really have zero Python experience.&amp;nbsp; I spent a few hours trying to develop an 'add-in', which was suggested by someone else in the general forum (where I posted originally), and it sounds like from your last response that it was wasted time.&amp;nbsp; *Sigh*&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have spent time looking at the script code from the MapAutomationTeam, but it's all a bit much for someone brand new to coding.&amp;nbsp; I only need to select the current records with each 'page next'.&amp;nbsp; At this point, I think my time is best spent hand selecting the necessary data for each page.&amp;nbsp; I'm sorry!&amp;nbsp; I was falsely under the impressing this would be a much easier fix.&amp;nbsp; I do appreciate all your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Katie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 21:09:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763228#M58972</guid>
      <dc:creator>KatieGaut1</dc:creator>
      <dc:date>2013-12-13T21:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763229#M58973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;.... So it seems you need something to 'reselect' the records based on the page definition; ....&amp;nbsp; It seems the problem is the graph will update only based on a selection .... &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Wayne,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a similar problem as Katie. And exactly the Quote above is the tricky part. My solution is a button, selecting all entries of the attribute table which includes the values for the graphs. These layer will "hide" all unused lines in the attribut table via "Definition Query - Page Definition". So this is not completely automatically.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The project you mentioned is very interesting, i will take a closer look.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The easiest way would be an option in the graph settings. "Show only selected features/record on the graph" additional: "Show only features/records based of DDP Index". Like for pictures, selecting a path from a Data Driven Pages field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 07:40:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763229#M58973</guid>
      <dc:creator>PSArcOnlinePSArcOnline</dc:creator>
      <dc:date>2013-12-16T07:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763230#M58974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I developed some short Python add-in code that isn't very sophisticated but seems to do the trick to select the records defined by the page definition query (the workaround stated above) -- I didn't include any code to select any features on opening the mxd, so you'll either have to 'toggle' the page to initialize the selection or enter the 'on open' code in the add-in yourself (or manually select the current page's relevant graph records, save and close the mxd).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here it is below, hard-coded for the 1st listed data frame and a temperature layer by station listed by the name, 'tempsStation' (you'll need to change that) - by the way, I think this graph can be based on just a table (not a feature layer), as long as the page definition query is also applied (via your Station_Id)...I can explain the logic later if you like, or if you have better logic certainly let me know.&amp;nbsp; The 1st time I implemented this with 'pageIndexExtentChanged' alone and created an infinite loop, so devised a way to 'disable' the object by toggling self.enabled.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import pythonaddins

class ExtensionClass1(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for testAddIn_addin.extension2 (Extension)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; def beforePageIndexExtentChange(self, old_id):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.enabled == False:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def pageIndexExtentChanged(self, new_id):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.enabled:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxd, 'tempsStation', df)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(lyr, '', '', '', 'SWITCH_SELECTION')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = False
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This was implemented with a wizard, downloaded from the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python Add-In Wizard&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop Application Template by teampython&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Last Modified: June 12, 2013&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=5f3aefe77f6b4f61ad3e4c62f30bff3b" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/home/item.html?id=5f3aefe77f6b4f61ad3e4c62f30bff3b&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need some sort of 'quick-start' on installation, just let me know...otherwise there's good help here (this is an 'application extension' add-in):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Application_Extension/014p00000019000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/Application_Extension/014p00000019000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can read all the subtopics of Python Add-Ins starting here--&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/What_is_a_Python_add_in/014p00000025000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/What_is_a_Python_add_in/014p00000025000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...but I found the testing and debugging sections most useful:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Testing_an_add_in/014p00000026000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/Testing_an_add_in/014p00000026000000/&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Debugging_Python_add_ins/014p0000001n000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/Debugging_Python_add_ins/014p0000001n000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something I forgot to mention - what if you had multiple graphs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This line in the code accommodates a single layer's graph:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lyr = arcpy.mapping.ListLayers(mxd, 'tempsStation', df)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So if you had multiple graphs by various sources (within the same data frame) you could still use ListLayers, then loop on the designated layers to run the selection command.&amp;nbsp; If in different dataframes, then you'd likely have a nested loop- a loop running on the layers inside a loop running on the specific data frames (return on ListDataFrames).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763230#M58974</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-12T08:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763231#M58975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Wayne,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this could be what i am searching for. But i had to try first. Sadly i haven't much time left this jear. But i will answer if it worked as soon as i implement it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a quick question. For selecting the features for my graph i use&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.SelectLayerByAttribute_management ("LayerWithGraphInfo","NEW_SELECTION","IndexID&amp;lt;&amp;gt;0")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Isn't there a "Select All" argument? "IndexID&amp;lt;&amp;gt;0" works because in the attribute table there is no IndexID value 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You use&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.SelectLayerByLocation_management(lyr, '', '', '', 'SWITCH_SELECTION')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why "LayerByLocation" and why "SWITCH_SELECTION"? Is this faster or less prone to errors?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 04:55:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763231#M58975</guid>
      <dc:creator>PSArcOnlinePSArcOnline</dc:creator>
      <dc:date>2013-12-17T04:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763232#M58976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just like the SWITCH_SELECTION option because it doesn't rely on a field (so the field to query doesn't have to exist).&amp;nbsp; You could implement it with your query if you wish, IndexID&amp;lt;&amp;gt;0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think there is a 'select all' option, not directly; however (and I tested this), the SWITCH_SELECTION is essentially a 'select all' function provided there is no initial selection.&amp;nbsp; The only time the query I used would ever fail is upon initialization (which I mentioned in the previous post), or if there are overlapping value selections to be made (SWITCH_SELECTION would not keep any currently selected features selected).&amp;nbsp; But I think that's covered too, in this case, because a page definition query is applied, and that depends on uniquely coded attributes.&amp;nbsp; (In Katie's case it is, but now that I think about, there may be exceptions...and you'd want to adjust your method of selection accordingly.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't test the performance - likely select by location in this case is faster since the actual spatial selection params are skipped.&amp;nbsp; I have to say it seems a little odd this was built into the sel by loc instead of sel by att.&amp;nbsp; But that's how it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 05:11:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763232#M58976</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-12-17T05:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763233#M58977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Again, thanks for your quick answer. I will try to change this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the moment my questions have been answered. At least for this year. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 05:18:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763233#M58977</guid>
      <dc:creator>PSArcOnlinePSArcOnline</dc:creator>
      <dc:date>2013-12-17T05:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763234#M58978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Wayne,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Again - I so appreciate your persistence!&amp;nbsp; I've spent a few hours looking through the tutorials, help pages and links you've posted.&amp;nbsp; I've created the add-in extension from your code, using my file name for the 'tempsStation' and 'created' the add-in with no errors.&amp;nbsp; I then enable the extension in ArcMap and try to load the add-in but get an error of, "No GUI components found in this Add-In."&amp;nbsp; Argh!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Any thoughts?&amp;nbsp; At least you're helping out other folks along the way it sounds like.&amp;nbsp; Thanks so much for your time and effort.&amp;nbsp; It's very much appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Katie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 22:51:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763234#M58978</guid>
      <dc:creator>KatieGaut1</dc:creator>
      <dc:date>2013-12-17T22:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763235#M58979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you can open your mxd and go to Customize (on the main menu) and click Extensions and in the pop-up window your extension (whatever you named it) is listed, that means it is already loaded.&amp;nbsp; Clicking the checkmark on means you are enabling it (yes do that).&amp;nbsp; You should be ready to test it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The way I wrote the code, it does nothing on loading the map - so click the arrow on the DDP toolbar to go to the next page and the add-in should take over to select your Page Definition Query records, which in turn should update the related graph (the graph properties should be set to display selected records).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if you get that far - if not we'll need to troubleshoot.&amp;nbsp; If you cannot enable your extension, then something else is wrong in creating the add-in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 23:56:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763235#M58979</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-12-17T23:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763236#M58980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Katie,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if you are interested then I will send you my little test project with my addin "select all button". But this will be my old version. I had no time to implement Waynes method yet. So if you want send me a PN with your Email. Don't want to upload it here because I think it is not sophisticated enough for public. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: I use ArcGIS 10.2&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 05:21:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763236#M58980</guid>
      <dc:creator>PSArcOnlinePSArcOnline</dc:creator>
      <dc:date>2013-12-18T05:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Likely Simple Python Question: dynamically selecting records</title>
      <link>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763237#M58981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; I got the code working and wanted to share - in case it helps the next person down the road.&amp;nbsp; I couldn't get the extension code, but this button works as well.&amp;nbsp; A big clunkier, but works all the same.&amp;nbsp; It was very simple in the end.&amp;nbsp; Thanks so much Wayne and PSArcOnline!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import pythonaddins&amp;nbsp; class Selection(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for SelectAllButton_addin.button (Button)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False &amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Select all features (in Test there are no features with FID 0). &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management ("XYMin_Max_Avg_Temp_with_Lat_Long","NEW_SELECTION","Station_Id"&amp;lt;&amp;gt;'0') &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 16:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/likely-simple-python-question-dynamically/m-p/763237#M58981</guid>
      <dc:creator>KatieGaut1</dc:creator>
      <dc:date>2014-01-07T16:46:10Z</dc:date>
    </item>
  </channel>
</rss>

