I want to create an Arcpy tool script that takes values from a 2-column table placed in the tool itself, which is filled by the user, and stores these values in a real table.

In order to do so, I have created a "Record Set" parameter in the script properties. This RecordSet has a data schema taken from an existing table and is composed by 2 columns (param1, param2) (see image below).

enter image description here

Once I execute the tool, the following form appears: enter image description here

As you can see, the tool has a table where the user can write any values, entering them directly to the table's rows (red dots in the image).

I have come to the solution of getting these values and storing them to a real table using arcpy:

tb = arcpy.CopyRows_management(in_recordset, "table_path")

And there is no problem with this, because it is done quite well.

However, this solution turns out to not being user friendly: In the first place, the upper box with the string "Script::t" on it can't be modified because when doing so, tool crashes. Secondly, one must click first to the "+" button to create a new row, and then fill the spaces. Additionally, while doing so, some cells turn in white and I have to "battle" a little bit with some clicks in order to have them all filled.

So, my question(s):

What is the upper box with the string "Script::t" intended for? And can it be taken out somehow?

And most important: is this the most apt solution to create the tool I need? Are there other options to insert a table to the tool by using another kind of parameter than "Record Set" parameter?

Hope I have explaied myself.


I think that "upper box" is something you cannot remove as that is the mechanism that allows you to enter a row into the table. If you have a look at other standard geo-processing tools you'll find that this is the way things are done. I have not found or can think of a tool that does not have an "upper box".

So you are wiring up an interface to an existing script, this is a script tool. If you explore a python toolbox you'll discover a more powerful method of running python scripts. You create the parameters in the code itself rather than wire up an interface to existing code. A parameter available in python toolbox is the ValueTable. I wrote a simple document over on geonet that describes this process. You have considerable control over what it can do, although I still think you can't get away from that "upper box", I'm sure there is some design philosophy behind it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.