"Select Data" modelbuilder question

736
2
Jump to solution
04-10-2014 07:04 AM
JayMukherjee
New Contributor III
I am new to modelbuilder.  I have a geodatabase with over 400 layers.  I would like to select a subset of the 400 and merge them into one layer.  The subset have the same suffix, but different prefixes, in their name. 

How do I select multiple layers with the same suffix?  The modelbuilder select data tool gives me a list with individual layers found within the geodatabase, but I want to select specific layers by the suffix name at once e.g. %_xyline or *_xyline.

Thanks!
0 Kudos
1 Solution

Accepted Solutions
T__WayneWhitley
Frequent Contributor
Not sure, but I don't think you can use in-line variable substitution within Select Data... however, you can take this general approach below with the use of a feature class iterator (using the wildcard option to apply your filter) and use Collect Values (a model-only tool) to feed a multi-value input into the Merge tool.  So, in summary:

1- Use a feature class iterator, essentially as a device for listing (filtering) the desired fcs from your specified gdb.

http://resources.arcgis.com/en/help/main/10.2/index.html#//00400000000r000000


2- Use Collect Values to 'build' your multival input expected by the Merge tool.....essentially, the 'frame' of your needed model is the essentially the 1st example listed here (but of course switch out Iterate Rasters for your Iterate Feature classes and switch out Mosaic To New Raster with your Merge - understand?

http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_using_Model_Only_tools_in_Mode...


3- Merge.


Note that I didn't test this, but this is relatively straightforward and should work fine -- if you want to try the Select Data route 1st to test in-line variable substitution, go ahead, and I'd be interested to know if that works, but I don't think that it will because that param doesn't appear to be rigged to handle more than 1 input at a time (why you likely need an iterator).  Otherwise I would have scripted this to initially filter with one of the Python listing function (ListFeatureClasses).  Impressive that it seems ModelBuilder can handle this (if you have access to iterators).

Wayne

View solution in original post

0 Kudos
2 Replies
T__WayneWhitley
Frequent Contributor
Not sure, but I don't think you can use in-line variable substitution within Select Data... however, you can take this general approach below with the use of a feature class iterator (using the wildcard option to apply your filter) and use Collect Values (a model-only tool) to feed a multi-value input into the Merge tool.  So, in summary:

1- Use a feature class iterator, essentially as a device for listing (filtering) the desired fcs from your specified gdb.

http://resources.arcgis.com/en/help/main/10.2/index.html#//00400000000r000000


2- Use Collect Values to 'build' your multival input expected by the Merge tool.....essentially, the 'frame' of your needed model is the essentially the 1st example listed here (but of course switch out Iterate Rasters for your Iterate Feature classes and switch out Mosaic To New Raster with your Merge - understand?

http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_using_Model_Only_tools_in_Mode...


3- Merge.


Note that I didn't test this, but this is relatively straightforward and should work fine -- if you want to try the Select Data route 1st to test in-line variable substitution, go ahead, and I'd be interested to know if that works, but I don't think that it will because that param doesn't appear to be rigged to handle more than 1 input at a time (why you likely need an iterator).  Otherwise I would have scripted this to initially filter with one of the Python listing function (ListFeatureClasses).  Impressive that it seems ModelBuilder can handle this (if you have access to iterators).

Wayne
0 Kudos
JayMukherjee
New Contributor III
Wayne,

It worked perfectly!  Thanks for your help.

J
0 Kudos