table = arcpy.GetParameter(0) result = table optable = result.getOutput(0)
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 headimport arcpy inTable = arcpy.GetParameterAsText(0) SearchRows = arcpy.SearchCursor(inTable) outTable = r'in_memory/OuTable' outRows = arcpy.InsertCursor(outTable) for row in SearchRows: value1 = row.NAME value2 = row.TYPE value3 = row.SUPERFIELD singleOutRow = outRows.newRow() singleOutRow.outNAME = value1 singleOutRow.outTYPE = value2 singleOutRow.outSUPERFIELD = value3 outRows.insertRow(singleOutRow) arcpy.SetParameter(1, outTable)
import arcpy inTable = arcpy.GetParameterAsText(0) SearchRows = arcpy.SearchCursor(inTable) outTable = r'in_memory/OuTable' outRows = arcpy.InsertCursor(outTable) for row in SearchRows: value1 = row.NAME value2 = row.TYPE value3 = row.SUPERFIELD singleOutRow = outRows.newRow() singleOutRow.outNAME = value1 singleOutRow.outTYPE = value2 singleOutRow.outSUPERFIELD = value3 outRows.insertRow(singleOutRow) arcpy.SetParameter(1, outTable)
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.I will play with what you've put up for a bit a post again. I really do appreciate the help.
I'm not sure this is exactly what you want to do, but try this code:import arcpy inTable = arcpy.GetParameter(0) arcpy.SetParameter(1, inTable) 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?And can you post a link to the doc where this isn't working? If you're using: table = arcpy.GetParameter(0) result = table optable = result.getOutput(0)Result should be the result of a GP operation....result = arcpy.TableToTable_conversion('inputTable','in_memory','outputTable) optable = result.getOutput(0)
import arcpy inTable = arcpy.GetParameter(0) arcpy.SetParameter(1, inTable)
result = arcpy.TableToTable_conversion('inputTable','in_memory','outputTable) optable = result.getOutput(0)
See the help topic Setting script tool parameters. It appears you want a derived output parameter, so pay particular attention to the write-ups about derived output parameters.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.