How do I make a multi value input with multiple columns?

3269
10
02-07-2016 07:37 PM
AllanMills
New Contributor III

  I'm fairly certain I should be able to do this but I can't seem to find out how. Basically I'm written a simple feature class merge tool in Python. It takes a series of input feature classes and a field name for each (the field represents a depth value). It then merges all of the feature classes into a single feature class with a depth field containing values from the field specified.

Writing the script wasn't hard, but I'm now trying to build the parameters for the script for a toolbox (note that this is a scripting tool, not a python toolbox tool). I need a multi value parameter that takes a feature class as an input and when one is selected it fills a combo box for a second input with all the field names for that feature class (or, for bonus points, just the numerical fields). But I can't find a way to set this up with the interface provided. I think the topo to raster tool in 3D analyst has an example of the sort of thing I want to.

I'm not certain if I can do this for a python script admittedly. I know I can do it in .NET but that is a different matter entirely.

0 Kudos
10 Replies
DanPatterson_Retired
MVP Esteemed Contributor

obtained from... Setting script tool parameters—Help | ArcGIS for Desktop

the fields are obtained from the selection of the featureclass

AllanMills
New Contributor III

Sorry but I think you've missed my point. I don't know how to make a multi value input with two columns that will automatically populate the second based on the first. I'm not sure what set of parameters to use.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

I must be misunderstanding, since I took it your first parameter would be a featureclass from which you wanted the list of its fields (the fields are obtained from the first parameter...so the type is fields, then obtained from is the featureclass)

AllanMills
New Contributor III

Yes, but it isn't a featureclass but multiple featureclasses. I want a multi value input that can take as many feature classes as the user wishes to specify and to specify a different field value for each of them.

So it could be FeatureClassA with field depth_val, FeatureClassB with field depth_field and FeatureClassC with field depth_in_meters all being input into the one input field.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

well in a conventional toolbox, it is going to look pretty horrendous particularly if your fields differ from fc to fc.  Your first parameter could be a workspace (folder or gdb), the second would be the feature classes (multiple) derived from the folder...now the impossible part... associating the fields with the featureclasses.  If you were doing something as simple as updating a single field then it would be possible.  I have a tendancy to script that kind of thing (like batch calculate area, perimeter, centroid coordinates) then make the toolbox and tool.  I have even done it within the script to create the fields if they don't exist, update if they do and put out values in different units (like projected and unprojected coordinates.

It can be done, but your workflow could be commented on by seeing your script rather than commenting in generalities.

0 Kudos
AllanMills
New Contributor III

I'm still not sure I'm getting my request across. What I want should look like the following image:

interface.PNG

Just without the Is a fault column at the end. I just want to be able to have an interface like that for input into the Python script I've written. Specifically I want it using the existing interface building wizard and without having to try any extra fancy coding.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor
AllanMills
New Contributor III

Yeah I might have to. I didn't build it as a toolbox to start with because this tool is basically going to merge feature classes for another tool and that tool is a python script rather than a python toolbox. So I they wanted this one to sit alongside it.

I don't think even a toolbox version will do it all though as I seem to recall you can't do multiple domains for a value table like you can in .NET.

Thanks for your help.

0 Kudos
ZackaryKing
New Contributor II

Were you ever able to figure this out? I working on a similar type tool. Getting a distinct field list/filter for each individual feature class seems impossible.

I am creating a script for LiDAR input with surface constraints that can have a z index field. It must be possible as the toolbox parameters work from model builder but setting it up out of a python script is a bit of a mind bender.

Zack

0 Kudos