<?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: Production of Graphs from Geodatabase Table in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302927#M23534</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is what the original script that I posted does.&amp;nbsp; What you will need to do is create a sample graph and update the script with the correct paths to your data.&amp;nbsp; Then, create a toolbox &amp;gt; right-click on the toolbox &amp;gt; Add Script &amp;gt; browse to the script.&amp;nbsp; You will also need to add a parameter to the script of type Long. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A user can then click on the script and it will open a dialog for them to specify a Meter Number.&amp;nbsp; Once they do and execute the tool, the meter number is queried and the graph is saved to a PDF.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Aug 2013 18:05:31 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2013-08-28T18:05:31Z</dc:date>
    <item>
      <title>Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302919#M23526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What I have is a table I produced from our Customer Information System showing the billed KWH Usage and KW Demand for a ALL electric meters over a period of time (From July 2011 to July 2013). There are about 900,000 records in this table of around 9500 electric meters. What I am trying to accomplish is listed below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Attached: Example.xlsx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is also in a File Geodatabase as a Geodatabase Table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This table is composed of around 9500 meter records (METER NUMBER)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Go through the table and find METER NUMBER record with the billing period, KWH and KW Demand rows attached.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Extract/export/select a unique METER NUMBER with the data attached (billing period, KWH and KW Demand)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Take the data and build a graph showing the Billing Period along the "X" Axis, KWH and KW Demand along the "Y" Axis&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Export the graph to a .PDF with the METER NUMBER as the file name&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From there I can use the Attachments Geoprocessing tool to take the .PDF and attach it to the Meter Location in the .MXD&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Long Term Goal is to create a One-Touch custom Button to select a specific METER NUMBER to create a graph described above and automatically create a .PDF. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this sounds like a huge project - and want to learn how to build it piece by piece to eventually accomplish the Long Term Goal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help in advanced&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 16:17:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302919#M23526</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-27T16:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302920#M23527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have part of an answer for you, the code below will allow you to extract out the information based on the unique billing numbers within your table. It doesn't yet create and export the graphs but more on that in a&amp;nbsp; minute. Here is the code for extracting the unique billing tables.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## extract unique records from a gdb table and make mulitple tables for
## graphing

import arcpy, os

arcpy.env.overwriteOutput = True

table = r'H:\Python\test.gdb\billing'

fields = ['BILLING_PERIOD','METER_NUMBER','KWH','KW_DEMAND']

# empty list to store unique meter numbers
meterNumbers = []

# use a search cursor to extract the unique numbers
with arcpy.da.SearchCursor(table,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[1] in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; meterNumbers.append(row[1])

# for each unique cursor make a table view using the billing number for
# the selection
for meter in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## omit the quotes if you table stores the meter number as a number not a string
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(table,'METER_NUMBER') + " = " + "'" + meter + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeTableView_management(table,"CurrentMeter",expression)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # copy the rows to a permanent table in the same location
&amp;nbsp;&amp;nbsp;&amp;nbsp; outTable = os.path.join(os.path.dirname(table),("meter_" + meter))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRows_management("CurrentMeter",outTable)

&amp;nbsp;&amp;nbsp;&amp;nbsp; ## at this point can use the graphing options to generate the graphs and save
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## unfortunately don't have the answer yet for this&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the copy rows at the end is not strictly need as you can do the graph creation in memory for each billing table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to create the graph purely using arcpy and ArcGIS you have a couple of options. There are the make and save graph tools which you can use based on a template graph created in arcmap, all that is required then is to modify the data source for each graph to your current table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively use the arcpy graph class to carry out all these steps, I believe you will need to use this class to modify the data sources in the previous example. THe save graph will then allow you to export to pdf.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is also matplotlib shipped with arcpy and that may be a better way to create the graphs. Sorry haven't used it so can't give you any steering on utilising it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps and gets you started. If i come up with anything I'll post again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302920#M23527</guid>
      <dc:creator>DaveBarrett</dc:creator>
      <dc:date>2021-12-11T14:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302921#M23528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is an example on how to accomplish this.&amp;nbsp; First, you will want to&amp;nbsp; create a sample graph in ArcMap.&amp;nbsp; Here is a screen shot of the&amp;nbsp; parameters I used:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27045[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After the graph is created, right-click on it and save it out as a .grf&amp;nbsp; file.&amp;nbsp; Now you can use the below code to create a graph of the "KW&amp;nbsp; Demand by Meter" by specifying a meter number:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\temp\python\test.gdb"

table = "Meters"

arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0))

out_graph_name = arcpy.GetParameterAsText(0)
out_graph_pdf = r"C:\Temp\python\Userdata" + "\\" + arcpy.GetParameterAsText(0) + ".pdf"
input_template = r"C:\Temp\Python\UserData\KW Demand.grf" #grf file previously saved
input_data = r"in_memory\table_sel"

# Create the graph
graph = arcpy.Graph()

# Add a vertical bar series to the graph
graph.addSeriesBarVertical(input_data, "KW_DEMAND")

# Specify the title of the left axis
graph.graphAxis[0].title = "KW Demand"

# Specify the title of the bottom axis
graph.graphAxis[2].title = "Meter Number"

# Specify the title of the Graph
graph.graphPropsGeneral.title = "KW Demand by Meter"

# Output a graph, which is created in-memory
arcpy.MakeGraph_management(input_template, graph, out_graph_name)

# Save the graph as an image
arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302921#M23528</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T14:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302922#M23529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Have part of an answer for you, the code below will allow you to extract out the information based on the unique billing numbers within your table. It doesn't yet create and export the graphs but more on that in a&amp;nbsp; minute. Here is the code for extracting the unique billing tables.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## extract unique records from a gdb table and make mulitple tables for
## graphing

import arcpy, os

arcpy.env.overwriteOutput = True

table = r'H:\Python\test.gdb\billing'

fields = ['BILLING_PERIOD','METER_NUMBER','KWH','KW_DEMAND']

# empty list to store unique meter numbers
meterNumbers = []

# use a search cursor to extract the unique numbers
with arcpy.da.SearchCursor(table,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[1] in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; meterNumbers.append(row[1])

# for each unique cursor make a table view using the billing number for
# the selection
for meter in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## omit the quotes if you table stores the meter number as a number not a string
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(table,'METER_NUMBER') + " = " + "'" + meter + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeTableView_management(table,"CurrentMeter",expression)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # copy the rows to a permanent table in the same location
&amp;nbsp;&amp;nbsp;&amp;nbsp; outTable = os.path.join(os.path.dirname(table),("meter_" + meter))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRows_management("CurrentMeter",outTable)

&amp;nbsp;&amp;nbsp;&amp;nbsp; ## at this point can use the graphing options to generate the graphs and save
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## unfortunately don't have the answer yet for this&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;the copy rows at the end is not strictly need as you can do the graph creation in memory for each billing table.&lt;BR /&gt;&lt;BR /&gt;If you want to create the graph purely using arcpy and ArcGIS you have a couple of options. There are the make and save graph tools which you can use based on a template graph created in arcmap, all that is required then is to modify the data source for each graph to your current table.&lt;BR /&gt;&lt;BR /&gt;Alternatively use the arcpy graph class to carry out all these steps, I believe you will need to use this class to modify the data sources in the previous example. THe save graph will then allow you to export to pdf.&lt;BR /&gt;&lt;BR /&gt;There is also matplotlib shipped with arcpy and that may be a better way to create the graphs. Sorry haven't used it so can't give you any steering on utilising it.&lt;BR /&gt;&lt;BR /&gt;Hope this helps and gets you started. If i come up with anything I'll post again.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;Dave&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Thank you for the Python script to find the unique Meter Number and export them out. I will play with this and see what I can come up with.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302922#M23529</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2021-12-11T14:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302923#M23530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Here is an example on how to accomplish this.&amp;nbsp; First, you will want to&amp;nbsp; create a sample graph in ArcMap.&amp;nbsp; Here is a screen shot of the&amp;nbsp; parameters I used:&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]27045[/ATTACH]&lt;BR /&gt;&lt;BR /&gt;After the graph is created, right-click on it and save it out as a .grf&amp;nbsp; file.&amp;nbsp; Now you can use the below code to create a graph of the "KW&amp;nbsp; Demand by Meter" by specifying a meter number:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\temp\python\test.gdb"

table = "Meters"

arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0))

out_graph_name = arcpy.GetParameterAsText(0)
out_graph_pdf = r"C:\Temp\python\Userdata" + "\\" + arcpy.GetParameterAsText(0) + ".pdf"
input_template = r"C:\Temp\Python\UserData\KW Demand.grf" #grf file previously saved
input_data = r"in_memory\table_sel"

# Create the graph
graph = arcpy.Graph()

# Add a vertical bar series to the graph
graph.addSeriesBarVertical(input_data, "KW_DEMAND")

# Specify the title of the left axis
graph.graphAxis[0].title = "KW Demand"

# Specify the title of the bottom axis
graph.graphAxis[2].title = "Meter Number"

# Specify the title of the Graph
graph.graphPropsGeneral.title = "KW Demand by Meter"

# Output a graph, which is created in-memory
arcpy.MakeGraph_management(input_template, graph, out_graph_name)

# Save the graph as an image
arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jake-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Thank you for the Python Script for creating a graph. I will work with that and see what I can come up with&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302923#M23530</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2021-12-11T14:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302924#M23531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay - what is not working here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## extract unique records from a gdb table and make mulitple tables for
## graphing

import arcpy, os

arcpy.env.overwriteOutput = True

table = "C:\MEWCo GIS System\Electric System\MEWCo_Electric_Model-LOCAL.gdb\billing"

fields = "BILLING_PERIOD";"METER_NUMBER";"KWH";"KW_DEMAND"

# empty list to store unique meter numbers
meterNumbers = []

# use a search cursor to extract the unique numbers
with arcpy.SearchCursor(table,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[1] in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; meterNumbers.append(row[1])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the error I'm getting:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "Z:\Operations\Maps and Records\GeoDatabase\MEWCO GIS System\Python Scripts\SearchCursorExample.py", line 16, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.SearchCursor(table,fields) as cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 820, in SearchCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.searchCursor(*args)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 357, in searchCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.SearchCursor(*gp_fixargs(args)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IOError: "C:\MEWCo GIS System\Electric System\MEWCo_Electric_Model-LOCAL.gdb illing" does not exist&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302924#M23531</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2021-12-11T14:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302925#M23532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your fields need to be a list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;fields = "BILLING_PERIOD";"METER_NUMBER";"KWH";"KW_DEMAND"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;fields = ["BILLING_PERIOD","METER_NUMBER","KWH","KW_DEMAND"]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mind me asking what's the purpose of creating a list of the meter numbers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 17:45:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302925#M23532</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-08-28T17:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302926#M23533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Your fields need to be a list.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Instead of:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;fields = "BILLING_PERIOD";"METER_NUMBER";"KWH";"KW_DEMAND"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;try:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;fields = ["BILLING_PERIOD","METER_NUMBER","KWH","KW_DEMAND"]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Mind me asking what's the purpose of creating a list of the meter numbers?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jake-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I am trying to do is to take a File Geodatabase Table that lists Electric Meters with their Peak KW Demand on a given billing period to eventually make a graph.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See previous posts in this thread for full explination.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am having a heck of a time with this Search Cursor just trying to get a list of unique meter numbers with all of the rest of the data and isolating the rows of the same meter number&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 17:50:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302926#M23533</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-28T17:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302927#M23534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is what the original script that I posted does.&amp;nbsp; What you will need to do is create a sample graph and update the script with the correct paths to your data.&amp;nbsp; Then, create a toolbox &amp;gt; right-click on the toolbox &amp;gt; Add Script &amp;gt; browse to the script.&amp;nbsp; You will also need to add a parameter to the script of type Long. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A user can then click on the script and it will open a dialog for them to specify a Meter Number.&amp;nbsp; Once they do and execute the tool, the meter number is queried and the graph is saved to a PDF.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 18:05:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302927#M23534</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-08-28T18:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302928#M23535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That is what the original script that I posted does.&amp;nbsp; What you will need to do is create a sample graph and update the script with the correct paths to your data.&amp;nbsp; Then, create a toolbox &amp;gt; right-click on the toolbox &amp;gt; Add Script &amp;gt; browse to the script.&amp;nbsp; You will also need to add a parameter to the script of type Long. &lt;BR /&gt;&lt;BR /&gt;A user can then click on the script and it will open a dialog for them to specify a Meter Number.&amp;nbsp; Once they do and execute the tool, the meter number is queried and the graph is saved to a PDF.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jake-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Sounds like I have most of the parts....a good part of them from you...and I really appreciate that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The biggest headache right now is I cannot figure out the Script for the Search Cursor to isolate individual meter number records to produce a single graph for a specific meter number&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 18:10:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302928#M23535</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-28T18:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302929#M23536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Attached is a zip file with an example.&amp;nbsp; Try the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; Extract the zip file to your C:\Temp directory&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; Open ArcMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; Under C:\Temp, expand the Data.gdb &amp;gt; Graph toolbox &amp;gt; double-click on the Script&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.&amp;nbsp; Specify a meter number, i.e. 8151830&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5.&amp;nbsp; Click OK to execute the tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Within your C:\Temp directory you should have a graph as a PDF.&amp;nbsp; Is this what you are looking for?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 18:26:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302929#M23536</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-08-28T18:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302930#M23537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Attached is a zip file with an example.&amp;nbsp; Try the following:&lt;BR /&gt;&lt;BR /&gt;1.&amp;nbsp; Extract the zip file to your C:\Temp directory&lt;BR /&gt;2.&amp;nbsp; Open ArcMap&lt;BR /&gt;3.&amp;nbsp; Under C:\Temp, expand the Data.gdb &amp;gt; Graph toolbox &amp;gt; double-click on the Script&lt;BR /&gt;4.&amp;nbsp; Specify a meter number, i.e. 8151830&lt;BR /&gt;5.&amp;nbsp; Click OK to execute the tool&lt;BR /&gt;&lt;BR /&gt;Within your C:\Temp directory you should have a graph as a PDF.&amp;nbsp; Is this what you are looking for?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jake-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; This is a great start - but it doesn't seem to be working according to your instructions. Is it open in ArcMap or ArcCatalog? - Also I dont see a place that asks me to type in a meter number&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 18:43:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302930#M23537</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-28T18:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302931#M23538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Jake-&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; This is a great start - but it doesn't seem to be working according to your instructions. Is it open in ArcMap or ArcCatalog? - Also I dont see a place that asks me to type in a meter number&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is an error I get back:&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 "C:\temp\Script1.py", line 8, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 153, in TableSelect&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used. [Meters]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used. [SELECT * FROM Meters WHERE METER_NUMBER = ]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (TableSelect).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 19:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302931#M23538</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-28T19:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302932#M23539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can open ArcMap, and then navigate to C:\temp using the Catalog window.&amp;nbsp; When you double-click on the script within the Toolbox, what do you see?&amp;nbsp; Can you send a screen shot?&amp;nbsp; What meter number did you specify?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 19:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302932#M23539</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-08-28T19:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302933#M23540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can open ArcMap, and then navigate to C:\temp using the Catalog window.&amp;nbsp; When you double-click on the script within the Toolbox, what do you see?&amp;nbsp; Can you send a screen shot?&amp;nbsp; What meter number did you specify?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I see&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 19:32:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302933#M23540</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-28T19:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302934#M23541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Okay - what is not working here?&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## extract unique records from a gdb table and make mulitple tables for
## graphing

import arcpy, os

arcpy.env.overwriteOutput = True

table = "C:\MEWCo GIS System\Electric System\MEWCo_Electric_Model-LOCAL.gdb\billing"

fields = "BILLING_PERIOD";"METER_NUMBER";"KWH";"KW_DEMAND"

# empty list to store unique meter numbers
meterNumbers = []

# use a search cursor to extract the unique numbers
with arcpy.SearchCursor(table,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[1] in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; meterNumbers.append(row[1])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This is the error I'm getting:&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "Z:\Operations\Maps and Records\GeoDatabase\MEWCO GIS System\Python Scripts\SearchCursorExample.py", line 16, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.SearchCursor(table,fields) as cursor:&lt;BR /&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 820, in SearchCursor&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.searchCursor(*args)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 357, in searchCursor&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.SearchCursor(*gp_fixargs(args)))&lt;BR /&gt;IOError: "C:\MEWCo GIS System\Electric System\MEWCo_Electric_Model-LOCAL.gdbilling" does not exist&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like this error is mainly caused by the use of the 10.1 data access search cursor not the normal search cursor at 10.0. The 10.0 search cursor does not support using the with context manager as well. There is no option to specify fields in 10.0 search cursor. The help below shows the syntax you need to use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000050000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000050000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry should have checked what version it was you were using&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302934#M23541</guid>
      <dc:creator>DaveBarrett</dc:creator>
      <dc:date>2021-12-11T14:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302935#M23542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is an error I get back:&lt;BR /&gt;&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "C:\temp\Script1.py", line 8, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0))&lt;BR /&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 153, in TableSelect&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;BR /&gt;ExecuteError: ERROR 999999: Error executing function.&lt;BR /&gt;An invalid SQL statement was used.&lt;BR /&gt;An invalid SQL statement was used. [Meters]&lt;BR /&gt;An invalid SQL statement was used. [SELECT * FROM Meters WHERE METER_NUMBER = ]&lt;BR /&gt;Failed to execute (TableSelect).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like the error here with the sql statement is missing field delimiters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the statement should have "field" and then the equals&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;old:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0)) &lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;new:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.TableSelect_analysis(table, r"in_memory\table_sel", '"METER_NUMBER"' + " = " + arcpy.GetParameterAsText(0)) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;alternatively for the field name you wish to use in the statment replace '"METER_NUMBER"' with &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.AddFieldDelimiters(table,"METER_NUMBER")&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this will add the correct delimiters for the workspace you are using.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/AddFieldDelimiters/018v0000006p000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/AddFieldDelimiters/018v0000006p000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 20:27:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302935#M23542</guid>
      <dc:creator>DaveBarrett</dc:creator>
      <dc:date>2013-08-28T20:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302936#M23543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## extract unique records from a gdb table and make mulitple tables for
## graphing

import arcpy, os

arcpy.env.overwriteOutput = True

table = r'H:\Python\test.gdb\billing'

fields = ['BILLING_PERIOD','METER_NUMBER','KWH','KW_DEMAND']

# empty list to store unique meter numbers
meterNumbers = []

# use a search cursor to extract the unique numbers
with arcpy.da.SearchCursor(table,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[1] in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; meterNumbers.append(row[1])

# for each unique cursor make a table view using the billing number for
# the selection
for meter in meterNumbers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## omit the quotes if you table stores the meter number as a number not a string
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(table,'METER_NUMBER') + " = " + "'" + meter + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeTableView_management(table,"CurrentMeter",expression)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # copy the rows to a permanent table in the same location
&amp;nbsp;&amp;nbsp;&amp;nbsp; outTable = os.path.join(os.path.dirname(table),("meter_" + meter))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRows_management("CurrentMeter",outTable)

&amp;nbsp;&amp;nbsp;&amp;nbsp; ## at this point can use the graphing options to generate the graphs and save
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## unfortunately don't have the answer yet for this&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jake - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The generation of the list of Billing Numbers was there to help ModernGIS automate the hole process. If I was doing this I would aim to have an input of the whole table and an output location to store all the graphs. It should be possible to use the list of unique Billing Numbers in a for loop to generate each graph.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've developed a bit of a lazy habit where I try to use the minimum clicks necessary. Can def cause a few headaches in the development though!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302936#M23543</guid>
      <dc:creator>DaveBarrett</dc:creator>
      <dc:date>2021-12-11T14:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302937#M23544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this makes a difference at all - but I am currently running ArcMap 10.0 and using Python 2.6. I am using IDLE to edit and run the script. Is this making a difference in the code and how its running? I am planning on upgrading to ArcMap 10.2 in the next week.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 21:10:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302937#M23544</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2013-08-28T21:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Production of Graphs from Geodatabase Table</title>
      <link>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302938#M23545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is what I see&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Right-click on the Script in the toolbox, click the Source tab, and make sure this is set to the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27069[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, check to make sure the Parameter is set:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27070[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, when you double-click on the Script in the toolbox, you should be presented with the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27071[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The user can enter in a meter number, and then an output graph will be created like the one attached.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 21:36:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/production-of-graphs-from-geodatabase-table/m-p/302938#M23545</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-08-28T21:36:11Z</dc:date>
    </item>
  </channel>
</rss>

