AnsweredAssumed Answered

Best practice with creating tables in script tools

Question asked by muellea on Jan 19, 2017
Latest reply on Jan 19, 2017 by bixb0012

I have difficulties to find a straightforward solution for, as i think, a simple task. In a script tool the user has to choose a location to save a table. I used a Table typed input field in the tool parameters, so in my script a get a parameter containing a path and name for the table. In my script i want to use CreateTable_management and AddField_management to structure the table for my needs. Later i use an insert cursor to fill the table.

The problem is, that, depending on what parameter value the user gave, i got different table formats, eg. the user selects a folder and a name without an extension, CreateTable builds an info table, within a geodatabase it builds a gdb table, with folder and extension .dbf it creates dbase table - i don't know how much possibilities there may be further. Creating a table produces different, automatically created fields:

- gdb: ObjectID

- dbf: OID, Field1

- info: Rowid, OBJECTID, FIELD1

 

I don't need these automatically created fields, i want my own structure, so : can i suppress the creation of those fields?

What would be a straightforward solution, working with tables in a script tool. I attached an example with code.

Attachments

Outcomes