Hello,
I am making a custom python tool but am having problems finding the correct parameter type to use:
I wish to make in_fc and in_fields equal to param0 and out_fc and out_fields equal to param1, both param0 and param1 have a 'File Geodatabase Table' data type.
Furthermore, if I want the output table to be created when the tool runs, where should I add the code to create a new table? I'm assuming it should be right before what I currently have in the execution code block.
Thanks,
John
Solved! Go to Solution.
Oops, sorry.
It's just "Table" in an atbx, but DETable in a python toolbox.
Use the dependency box for the fields parameter to make it so it draws from the input table parameter. Also note that I set the data type for the fields parameter to Field and set it as multivalue.
Easiest to just make threeparameters:
in_fc and out_fc: DETable
in_fields: Field
The reason I say only three is because it looks like you're using the same fields for both tables. If you're not, i'd suggest making a tool to make the second table with the fields you want and another tool to do the appending, since you'll need to use a fieldmap to make it work correctly.
You'll also want to add a dependency to the in_field so they pull from the input tables.
You're correct, make the out_fc before doing your cursor and use addfield or addfields (harder, imo) to get the right ones. (Or copy the schema of the in_table)
Hi Alfred,
Thanks for your suggestions, I couldn't find the DETable in the parameter data types here:
Also, is there a way to generate the Field parameter dynamically?
Thanks,
John
Oops, sorry.
It's just "Table" in an atbx, but DETable in a python toolbox.
Use the dependency box for the fields parameter to make it so it draws from the input table parameter. Also note that I set the data type for the fields parameter to Field and set it as multivalue.