Grab field value from featureset based Select by Location results

446
2
09-27-2017 07:55 AM
GalAvraham
New Contributor II

Hi

I'm trying to figure out how to extract a value of records returned from a Select by Location model I built.

Here's the process (in bold, the parameters name as defined in the model its picture is attached to this post):

  1. The process starts with the execution of a 'Select by Location' tool, in which the user select a certain feature from a defined feature layer, (AttachGeometry) using a featureset (InteractiveSelect)- this part of the tool goes fine easily as a selection is evident after the model finishes its run. 
  2. I then use the 'Iterate Field Values' tool over the returned feature(s) (SelectedLocations), aiming at garbing the unique value (DocID) for a specific field - this is where, as I suspect, my problem, as no value is 'transferred' to the next step of the process.
  3. This value is then transferred (as In line parameter, as can be see in the picture attached to this post) to a 'Select by Attribute' tool, for retrieving the matching records in another table, based on this value
  4. The process ends when the selected records are exported as a new table (Results).

As noted above, the 'Iterate Field Values' returns no values, thus no selection is made when the 'Select by Attribute' section of the model is executed - a new table is created, with no records in it. I receive the following message for the exported records: 'WARNING 000117: Warning empty output generated'.

Any help will be appreciated.

Gal

0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor

May be it is the Select By Attribute that is failing?

Things to check:

  • Does the field populating DocID actually contain any data?
  • If it does are they sensible values, for example geomGUID has ID values ABC and docID is returning 123
  • Your expression implies that geomGUID field is a string field is that correct?
0 Kudos
ChrisDonohue__GISP
MVP Alum

Not sure if this is the issue, but I'll throw it out there.  To add to what Duncan Hornby  suggested, what sort of database is the information coming from?  Depending upon which database is being used, one uses different formatting for the field names.

Fields

To specify a field in an SQL expression, provide a delimiter if the field name would otherwise be ambiguous, such as if it were the same as an SQL reserved keyword.

Since there are many reserved keywords, and new ones can be added in subsequent releases, a good practice is to always enclose a field name with a delimiter.

Field name delimiters differ from DBMS to DBMS. If you're querying any file-based data, such as a file geodatabase, ArcSDE geodatabase data, or data in an ArcIMS feature class or image service sublayer, you can enclose field names in double quotes:

"AREA"

If you're querying personal geodatabase data, you can enclose fields in square brackets:

[AREA]

For personal geodatabase raster datasets, you should enclose field names in double quotes:

"AREA"

For File geodatabase data you can enclose your field names in double quotes, but it's generally not needed.

AREA

Source:  SQL reference for query expressions used in ArcGIS—Help | ArcGIS for Desktop 

Also, one Modelbuilder troubleshooting suggestion.  Open the model in Edit Mode, Validate it, then run it (still in Edit Mode) by manually activating each step (Right-click on box, Run).  Hover over each completed box (has shadow) to see the values it produced.  This can help track down which step is failing.

Chris Donohue, GISP