<?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: Python in model builder...how do I output a table? in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529985#M17666</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;See the help topic &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Setting_script_tool_parameters/00150000000n000000/"&gt;Setting script tool parameters&lt;/A&gt;. It appears you want a derived output parameter, so pay particular attention to the write-ups about derived output parameters.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For right now, I just want to take a table in, put a table out, and display it. I have read all the documentation, I just can't find anything that works. The getOuput seems to error because, perhaps, it is not the output of a tool. Ok, so....how do I assign a variable as an output?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any advice on how to save my modified lists into a file I can output as a recordset will also be helpful, but is a problem for later.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Aug 2011 18:48:48 GMT</pubDate>
    <dc:creator>SeanCook</dc:creator>
    <dc:date>2011-08-22T18:48:48Z</dc:date>
    <item>
      <title>Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529983#M17664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all. I am having trouble figuring out how to return a table from a python script in model builder. I want to take a table view in and output a recordset. I was hoping something like the below would work, but it does not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;table = arcpy.GetParameter(0)
result = table
optable = result.getOutput(0)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone could tell me the magic line that will let me get the above to work, I would greatly appreciate it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do intend to modify the table later, but right now inputting and outputting an identical table would be a huge step forward.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance to whoever reads this!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2011 17:59:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529983#M17664</guid>
      <dc:creator>SeanCook</dc:creator>
      <dc:date>2011-08-22T17:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529984#M17665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;See the help topic &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Setting_script_tool_parameters/00150000000n000000/"&gt;Setting script tool parameters&lt;/A&gt;&lt;SPAN&gt;. It appears you want a derived output parameter, so pay particular attention to the write-ups about derived output parameters.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2011 18:26:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529984#M17665</guid>
      <dc:creator>DaleHoneycutt</dc:creator>
      <dc:date>2011-08-22T18:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529985#M17666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;See the help topic &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Setting_script_tool_parameters/00150000000n000000/"&gt;Setting script tool parameters&lt;/A&gt;. It appears you want a derived output parameter, so pay particular attention to the write-ups about derived output parameters.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For right now, I just want to take a table in, put a table out, and display it. I have read all the documentation, I just can't find anything that works. The getOuput seems to error because, perhaps, it is not the output of a tool. Ok, so....how do I assign a variable as an output?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any advice on how to save my modified lists into a file I can output as a recordset will also be helpful, but is a problem for later.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2011 18:48:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529985#M17666</guid>
      <dc:creator>SeanCook</dc:creator>
      <dc:date>2011-08-22T18:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529986#M17667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not sure this is exactly what you want to do, but try this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
inTable = arcpy.GetParameter(0)
arcpy.SetParameter(1, inTable)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe I'm confused why you're casting something to something else? If you want to inspect the attributes of the featureclass you can do it the same if its features or a table (recordset). I assume you'll be using a search cursor to loop through the attributes?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And can you post a link to the doc where this isn't working? If you're using: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;table = arcpy.GetParameter(0)
result = table
optable = result.getOutput(0)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Result should be the result of a GP operation....&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;result = arcpy.TableToTable_conversion('inputTable','in_memory','outputTable)
optable = result.getOutput(0)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529986#M17667</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2021-12-11T23:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529987#M17668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm not sure this is exactly what you want to do, but try this code:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
inTable = arcpy.GetParameter(0)
arcpy.SetParameter(1, inTable)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Maybe I'm confused why you're casting something to something else? If you want to inspect the attributes of the featureclass you can do it the same if its features or a table (recordset). I assume you'll be using a search cursor to loop through the attributes?&lt;BR /&gt;&lt;BR /&gt;And can you post a link to the doc where this isn't working? If you're using: &lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;table = arcpy.GetParameter(0)
result = table
optable = result.getOutput(0)&lt;/PRE&gt;&lt;BR /&gt;Result should be the result of a GP operation....&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;result = arcpy.TableToTable_conversion('inputTable','in_memory','outputTable)
optable = result.getOutput(0)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, I am working with arcserver, and my only is to be able to do whatever I want with a table....preferably by using a search cursor to feed it into lists, modify the values, and then output a recordset which can be displayed in arcserver.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will play with what you've put up for a bit a post again. I really do appreciate the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How would you turn a list of lists into a recordset? Write it to a csv, then save that using table to table, then output that derived table?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was casting something into something else because I couldn't figure out what the results method did.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:04:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529987#M17668</guid>
      <dc:creator>SeanCook</dc:creator>
      <dc:date>2021-12-11T23:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529988#M17669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Ok, I am working with arcserver, and my only goal is to be able to do whatever I want with a table....preferably by using a search cursor to feed it into lists, modify the values, and then output a recordset which can be displayed in arcserver.&lt;BR /&gt;&lt;BR /&gt;I will play with what you've put up for a bit a post again. I really do appreciate the help. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Right - I wouldn't worry about the conversion then...just use the cursor right off the input features. Do you thing, then write out the new table. Here's some untested code off the top of my head&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

inTable = arcpy.GetParameterAsText(0)

SearchRows = arcpy.SearchCursor(inTable)

outTable = r'in_memory/OuTable'
outRows = arcpy.InsertCursor(outTable)

for row in SearchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value1 = row.NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value2 = row.TYPE
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value3 = row.SUPERFIELD
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow = outRows.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow.outNAME = value1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow.outTYPE = value2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow.outSUPERFIELD = value3
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outRows.insertRow(singleOutRow)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.SetParameter(1, outTable)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:04:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529988#M17669</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2021-12-11T23:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529989#M17670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Right - I wouldn't worry about the conversion then...just use the cursor right off the input features. Do you thing, then write out the new table. Here's some untested code off the top of my head&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

inTable = arcpy.GetParameterAsText(0)

SearchRows = arcpy.SearchCursor(inTable)

outTable = r'in_memory/OuTable'
outRows = arcpy.InsertCursor(outTable)

for row in SearchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value1 = row.NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value2 = row.TYPE
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value3 = row.SUPERFIELD
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow = outRows.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow.outNAME = value1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow.outTYPE = value2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; singleOutRow.outSUPERFIELD = value3
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outRows.insertRow(singleOutRow)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.SetParameter(1, outTable)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, I might want to transpose rows and fields, etc, not just modify values. I am going to be creating a substantially different table than what I am inputting. Also editing field names, deleting fields, adding fields, moving fields, etc. It's going to get extremely slow using arc tools.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:04:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529989#M17670</guid>
      <dc:creator>SeanCook</dc:creator>
      <dc:date>2021-12-11T23:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529990#M17671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kevin, you have been a huge help. I got it working for now....thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2011 22:12:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529990#M17671</guid>
      <dc:creator>SeanCook</dc:creator>
      <dc:date>2011-08-22T22:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python in model builder...how do I output a table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529991#M17672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi khibma,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a geoprocessing service �??A�?� that returns output as GPRecordset.&amp;nbsp;&amp;nbsp; Now I want to use the returned recordset&amp;nbsp; as input into another GP service �??B�?� that is created using python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I am using following to set input type inside the python script for service �??B�?�:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Arcpy.GetParameter(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And from Script side (Gp properties) I am setting input type&amp;nbsp; �??Recordset�?� as parameter type. Attached is the screenshot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I try to run the service �??B�?�, it fails as it is not allowing passing record set as input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The workflow I am trying to accomplish is generating tables from GP service �??A�?� and passing that tables (as recordset) to GP service �??B�?� for reporting. I am struggling with passing the data to GP service �??B�?�.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would highly appreciate any help in this regard.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI: Working with ARCGIS Server 10.0. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sumit&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 19:39:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-in-model-builder-how-do-i-output-a-table/m-p/529991#M17672</guid>
      <dc:creator>SumitSharma</dc:creator>
      <dc:date>2013-12-07T19:39:30Z</dc:date>
    </item>
  </channel>
</rss>

