What does the message "Item not found in this collection." mean?

3695
13
01-07-2019 06:24 AM
StephenTucker
New Contributor

A model provokes the message "Item not found in this collection." while running the Make Feature Layer tool. What does this message mean? What might be wrong?

0 Kudos
13 Replies
DanPatterson_Retired
MVP Emeritus

That seems to be an old/remnant error

NIM005846: After renaming a dataset in ArcCatalog the error mes.. 

or your query to gather data to make the featurelayer produced no results IF you were using a where clause.

Or... your data were flagged as intermediate in the model

Make Feature Layer—Data Management toolbox | ArcGIS Desktop 

0 Kudos
StephenTucker
New Contributor

Thanks for your reply, Dan.

Well, (a) I have not renamed the feature class, (b) the Make Feature Layer invokation does not use a WHERE clause, and (c) the input feature class is not flagged as Intermediate. I append here the relevant part of the log of the run - you will see that the text that I quoted in my question is the whole of the error message.

-------------------------------

Executing (MaFeLa - Deri Lg Pg Fr FL from FC): MakeFeatureLayer "C:\Users\Stephen Tucker\Documents\ArcGIS\scratch.gdb\CBM_A4_L_FC_1" CBM_A4_L_FL_1 # # "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;FID_CBM_A1_L_FC_1 FID_CBM_A1_L_FC_1 VISIBLE NONE;LONG_ LONG_ VISIBLE NONE;LAT LAT VISIBLE NONE;ETH_NO ETH_NO VISIBLE NONE;ETH_LG_R ETH_LG_R VISIBLE NONE;ID ID VISIBLE NONE;Sensitivity Sensitivity VISIBLE NONE;Widespread Widespread VISIBLE NONE;ISO_LANGUAGE_CODE_ID ISO_LANGUAGE_CODE_ID VISIBLE NONE;COUNTRY_ISO_3DIGIT COUNTRY_ISO_3DIGIT VISIBLE NONE;COUNTRY_ISO_ALPHA_2 COUNTRY_ISO_ALPHA_2 VISIBLE NONE;FID_CBM_L2_L_FC_1 FID_CBM_L2_L_FC_1 VISIBLE NONE;FID_CBM_A1_L_FC_12 FID_CBM_A1_L_FC_12 VISIBLE NONE;LONG1 LONG1 VISIBLE NONE;LAT_1 LAT_1 VISIBLE NONE;ETH_NO_1 ETH_NO_1 VISIBLE NONE;ETH_LG_R_1 ETH_LG_R_1 VISIBLE NONE;ID_1 ID_1 VISIBLE NONE;Sensitivity_1 Sensitivity_1 VISIBLE NONE;Widespread_1 Widespread_1 VISIBLE NONE;ISO_LANGUAGE_CODE_ID_1 ISO_LANGUAGE_CODE_ID_1 VISIBLE NONE;COUNTRY_ISO_3DIGIT_1 COUNTRY_ISO_3DIGIT_1 VISIBLE NONE;COUNTRY_ISO_ALPHA_23 COUNTRY_ISO_ALPHA_23 VISIBLE NONE;CENTROID_X CENTROID_X VISIBLE NONE;CENTROID_Y CENTROID_Y VISIBLE NONE;ORIG_FID ORIG_FID VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE"
Start Time: Mon Jan 07 14:31:57 2019
Item not found in this collection.
Failed to execute (MaFeLa - Deri Lg Pg Fr FL from FC).

-------------------------------

Do you any more suggestions?

0 Kudos
DanPatterson_Retired
MVP Emeritus

And it works if you run the tool manually? (just to confirm... and if you are using arcmap, copy the python snippet that does)

0 Kudos
StephenTucker
New Contributor

Yes, it works if I open the Make Feature Layer tool, drag the relevant feature class and drop it in the Input Feature box - see the appended log below.

Sorry, but what do you mean by "the python snippet"? I am using ArcMap, but not Python - I am using Model Builder.

---------------------

Executing: MakeFeatureLayer "C:\Users\Stephen Tucker\Documents\ArcGIS\scratch.gdb\CBM_A4_L_FC_1" CBM_A4_L_FC_1_Layer # # "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;FID_CBM_A1_L_FC_1 FID_CBM_A1_L_FC_1 VISIBLE NONE;LONG_ LONG_ VISIBLE NONE;LAT LAT VISIBLE NONE;ETH_NO ETH_NO VISIBLE NONE;ETH_LG_R ETH_LG_R VISIBLE NONE;ID ID VISIBLE NONE;Sensitivity Sensitivity VISIBLE NONE;Widespread Widespread VISIBLE NONE;ISO_LANGUAGE_CODE_ID ISO_LANGUAGE_CODE_ID VISIBLE NONE;COUNTRY_ISO_3DIGIT COUNTRY_ISO_3DIGIT VISIBLE NONE;COUNTRY_ISO_ALPHA_2 COUNTRY_ISO_ALPHA_2 VISIBLE NONE;FID_CBM_L2_L_FC_1 FID_CBM_L2_L_FC_1 VISIBLE NONE;FID_CBM_A1_L_FC_12 FID_CBM_A1_L_FC_12 VISIBLE NONE;LONG1 LONG1 VISIBLE NONE;LAT_1 LAT_1 VISIBLE NONE;ETH_NO_1 ETH_NO_1 VISIBLE NONE;ETH_LG_R_1 ETH_LG_R_1 VISIBLE NONE;ID_1 ID_1 VISIBLE NONE;Sensitivity_1 Sensitivity_1 VISIBLE NONE;Widespread_1 Widespread_1 VISIBLE NONE;ISO_LANGUAGE_CODE_ID_1 ISO_LANGUAGE_CODE_ID_1 VISIBLE NONE;COUNTRY_ISO_3DIGIT_1 COUNTRY_ISO_3DIGIT_1 VISIBLE NONE;COUNTRY_ISO_ALPHA_23 COUNTRY_ISO_ALPHA_23 VISIBLE NONE;CENTROID_X CENTROID_X VISIBLE NONE;CENTROID_Y CENTROID_Y VISIBLE NONE;ORIG_FID ORIG_FID VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE"
Start Time: Mon Jan 07 15:31:25 2019
Succeeded at Mon Jan 07 15:31:25 2019 (Elapsed Time: 0.12 seconds)

---------------------

0 Kudos
DanPatterson_Retired
MVP Emeritus

As for manually, I mean, use the MakeFeatureLayer tool in Arctoolbox... I just want to know what the python snippet shows if it works.  

Modelbuilder should be tested when errors occur by using the actual tool from arctoolbox.  If helps with finding out if there are path issues or issues with parameters which usually aren't exposed as parameters (P) in modelbuilder.  (on a side note, when you get used to looking at arctoolbox code snippets, you can actually produce a script that replicates the model... modelbuilder is great for the visual, but less so, when steps get out of order or input parameters are specified but should be)

0 Kudos
StephenTucker
New Contributor

Sorry, Dan, but I am still not clear what you mean by "the Python snippet". I could export the model as a Python script and run that, but, actually, I am doing that sort of thing a lot these days and have other problems with it, so I would rather not complicate the issue by "going there" at this point. Also, I think that you do not mean me to do that by referring to a Python Snippet. Neither, actually, do I understand what you mean by "arctoolbox code snippets". I realise that some ArcToolbox tools are scripts that are written by ESRI staff (and apparently made available to Python programmers like me). I would hardly call these "snippets", but they are the closest things I know of that might bear that description.

0 Kudos
MartynTattersall
New Contributor II

Hi Stephen,

I believe Dan is suggesting you run the MakeFeatureLayer tool in ArcMap with the working statement you wish to use for selection. Once the tool has run, check the results window, right click on the tool run and copy the python snippet.

Drop the python snippet in to your script to replace the failing current script or compare against what you already have written.

0 Kudos
StephenTucker
New Contributor

Martyn,

Thanks for this. I am trying to do as you suggest, but am failing, I believe. This is what I have done:

(1) Open ArcMap (10.4) and Catalog pane; (2) Right-click the Make Feature Layer tool entry in the list of System Toolboxes, and click Open; (3) Drag the relevant feature class from the Catalog pane and drop it into the Input Features box - the Output Layer box is populated automatically; (4) Since I am not using a WHERE clause, I then click OK (by the way, is the WHERE clause what you mean when you say, "the working statement you wish to use for selection"?); (5) I check the run log (is this what you mean when you say the "results window"?) and find that the tool has run successfully (the log is appended below).

At this point I am trying to understand what you mean when you say, "right-click on the tool run". Since right-clicking on the log has no effect, I guess that you mean that I should right-click on the entry in the Catalog pane for the tool that I have just run, namely, Make Feature Layer. Well, I do this, but no Python snippet appears - the closest I can get to this are the examples given in the documentation - I am pretty certain you don't mean those.

Here is the run log:

----------------------

Executing: MakeFeatureLayer "C:\Users\Stephen Tucker\Documents\ArcGIS\scratch.gdb\CBM_A4_L_FC_1" CBM_A4_L_FC_1_Layer1 # # "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;FID_CBM_A1_L_FC_1 FID_CBM_A1_L_FC_1 VISIBLE NONE;LONG_ LONG_ VISIBLE NONE;LAT LAT VISIBLE NONE;ETH_NO ETH_NO VISIBLE NONE;ETH_LG_R ETH_LG_R VISIBLE NONE;ID ID VISIBLE NONE;Sensitivity Sensitivity VISIBLE NONE;Widespread Widespread VISIBLE NONE;ISO_LANGUAGE_CODE_ID ISO_LANGUAGE_CODE_ID VISIBLE NONE;COUNTRY_ISO_3DIGIT COUNTRY_ISO_3DIGIT VISIBLE NONE;COUNTRY_ISO_ALPHA_2 COUNTRY_ISO_ALPHA_2 VISIBLE NONE;FID_CBM_L2_L_FC_1 FID_CBM_L2_L_FC_1 VISIBLE NONE;FID_CBM_A1_L_FC_12 FID_CBM_A1_L_FC_12 VISIBLE NONE;LONG1 LONG1 VISIBLE NONE;LAT_1 LAT_1 VISIBLE NONE;ETH_NO_1 ETH_NO_1 VISIBLE NONE;ETH_LG_R_1 ETH_LG_R_1 VISIBLE NONE;ID_1 ID_1 VISIBLE NONE;Sensitivity_1 Sensitivity_1 VISIBLE NONE;Widespread_1 Widespread_1 VISIBLE NONE;ISO_LANGUAGE_CODE_ID_1 ISO_LANGUAGE_CODE_ID_1 VISIBLE NONE;COUNTRY_ISO_3DIGIT_1 COUNTRY_ISO_3DIGIT_1 VISIBLE NONE;COUNTRY_ISO_ALPHA_23 COUNTRY_ISO_ALPHA_23 VISIBLE NONE;CENTROID_X CENTROID_X VISIBLE NONE;CENTROID_Y CENTROID_Y VISIBLE NONE;ORIG_FID ORIG_FID VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE"
Start Time: Tue Jan 08 10:41:36 2019
Succeeded at Tue Jan 08 10:41:36 2019 (Elapsed Time: 0.73 seconds)

----------------------

I am getting the impression that my original problem is being caused by what I will call the ModelBuilder Interpreter. (that is, the software that takes a model and runs it.) I am hoping that I can get round this by exporting to a Python script the model that is using the Make Feature Layer tool. I have already done that with another troublesome model and the Python worked OK. (This other model is intended to copy a feature class from the scratch GDB to a file geodatabase - the problem was that when it ran the Calculate Value tool, the message "No current record." was provoked.)

Eventually I will be needing to export the whole model-based system to Python anyway so that it can be run on other team members' computers.

0 Kudos
MartynTattersall
New Contributor II

Rather than looking in to the run log right click the run and click the copy python snippet drop down.

Paste the snippet in to a script editor (e.g. notepad++). If you are wanting to run this in a script rather than from a tool be aware of the first comment that is included in the python snippet. # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script.

This snippet is the extensive way of writing the code, it could be easier/cleaner to check the guidance and write the code from scratch if you are not using an expression.

From the original question I do not know why your model builder is failing from what you have given unfortunately, just helping to explain what Dan was eluding to but python snippets are helpful for future endeavors!

Martyn

0 Kudos