Iterate feature selection doesn't pass selection to next tool

2344
6
Jump to solution
02-18-2021 09:32 PM
Labels (1)
Tuppins
New Contributor II

I'm trying to run Iterate Feature Selection and then using Copy Features to save the selections. The iterator runs just fine, but the selections are not passed to the Copy Features tool. Any ideas why or how else to save the temporary feature selections with the value field output (Group_month here)? Thanks for any input and sorry if this is something trivial, I'm having a hard time finding help on this.

EmmaM_0-1613712532280.png

 

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

It's been a long time since using model builder, so looking though the help Inline variable substitution—ArcGIS Pro | Documentation, it seems that %workspace% can also be supplied as a parameter, which means I guess (if current workspace environment is set and an FGDB) - %workspace%\%Group_month%

However the invalid name error intrigues me, can you provide an example of what you tried? Also what does this field look like? i.e. if it starts with a number you won't be able to create the feature class.

View solution in original post

0 Kudos
6 Replies
DavidPike
MVP Frequent Contributor

You need to put some more meat on the bone.  

Are you sure the features are being selected properly in the iterator, and please share as much detail as possible on your inputs, intended output, and the input dialogues for Iterate FS and Copy Feat.

0 Kudos
Tuppins
New Contributor II

Thanks for your response @DavidPike.

I am sure the features are being selected properly in the iterator - when I add these to the display, they are all shown correctly but do not have unique names. I wanted to use copy features to save these as feature classes with the name from the value field of the iterator. The input to the iterate features tool is a point feature class that has locations of observations for groups in different months and I am grouping by fields of group and month - the intended output here is that I have a separate feature class for every permutation of group and month (e.g. Group1January to Group4December). I have put the feature selection that the iterate feature selection tool creates into the input of the copy features tool, and for the output feature class I have specified the name as the value field from the iterate features tool. The iterate features tool will run completely, but none of the outputs of this tool are passed to the copy features tool so if I run the iterate features tool in ModelBuilder, it will show as run (and features will appear if I add them to the display), but the copy features tool does not run with it. If I try to run Copy Features after the iterator has run, I get the error ERROR 000210: Cannot create output Group1January

0 Kudos
DavidPike
MVP Frequent Contributor

If you haven't got a workspace environment (FGDB) set then the output wouldn't work.

I would probably say this is the issue, try (the path is an example):

D:\MyGISProject\IterateToolOutputs\Default.gdb\%Group_month%

or

D:\MyGISProject\IterateToolOutputs\%Group_month%.shp

0 Kudos
Tuppins
New Contributor II

Thank you for taking the time to help me! I'm pretty stumped. I do have a gdb set for the environment for my workspace.

By switching the tool downstream of the iterator from Copy Features to the Select tool, I've managed to get the iterator to pass the argument to the select tool, but when I enter the full file path followed by %Group_month% I get Error 000354 The name contains invalid characters. If I try "%Group_month%" (i.e. in quotes) I go back to the same error as before, but with the full path listed - ERROR 000210: Cannot create output C:\...MyGDB.gdb\"Group1_Jan"

0 Kudos
DavidPike
MVP Frequent Contributor

It's been a long time since using model builder, so looking though the help Inline variable substitution—ArcGIS Pro | Documentation, it seems that %workspace% can also be supplied as a parameter, which means I guess (if current workspace environment is set and an FGDB) - %workspace%\%Group_month%

However the invalid name error intrigues me, can you provide an example of what you tried? Also what does this field look like? i.e. if it starts with a number you won't be able to create the feature class.

0 Kudos
Tuppins
New Contributor II

I had forgotten that I did in fact have a group that started with a number 😞

So between switching to Select instead of Copy Features, and more importantly fixing the numeric group, it is now working. Thanks again for your help!