7

I have developed a script tool which will allow a user to specify input feature class or table and then will process it.

Surprised I haven't noticed this before: I cannot find which data type my input features parameter should be to let users specify both feature class / tables (by drag-n-drop from Catalog window or browsing to a place on the disk) and layers from the table of contents (TOC) in case they have already added a feature class / table to the map document.

Dataset and Feature Class type will let me to browse to tables/feature classes and feature classes only, respectively. Layer will let me specify the added feature layer from the TOC only.

enter image description here

Core GP tools such as Frequency and many others, in contrast, will let you drag-n-drop feature classes/tables and choose a layer/table in case you have some added to the TOC.

I've read through the list of GP data types from the Esri Help, but cannot find any that will help me. Am I hitting one of the limitations of the custom script tools? I am on 10.2.1.

2 Answers 2

3

The Table View parameter (latest GP data types here) will allow you to select both tables and feature classes on disk as well as in the TOC. This will work in Model Builder as well as toolbox scripts.

As a drop down from TOC:

enter image description here

When opening from disk: enter image description here

2

Feature Layer should be the data type that allows you to do both.

4
  • Feature layer can indeed let you use both feature classes and layers in the TOC, but they don't let you in tables or tables in the TOC. I have updated my question to make it more clear. Mar 26, 2014 at 15:53
  • Are you sure? I can select a table if I have feature layer as the data type.
    – ianbroad
    Mar 26, 2014 at 15:59
  • 1
    Layer is not the same as Feature Layer.
    – ianbroad
    Mar 26, 2014 at 16:05
  • @ian, yea, I am pretty sure. I get 'Invalid drop item' message when trying to drop a table into a parameter area. If you browse, only feature classes and .lyr files are listed. Mar 29, 2014 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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