TransWikia.com

Iterate Field Value and Select by Attribute in ArcMap does not select rows after first iteration

Geographic Information Systems Asked by MierMoto on August 17, 2021

I’m running ArcGIS 10.3 on Windows 10.

I need to find all the Block names and identify the record with the largest area. Then I need to calculate the Species across to the last field. However, it doesn’t seem to do anything after the first iteration.

To do this I set up a basic iteration on field values, using unique values in the Blocks feature class below (which has the same Block names as the input feature class for the "Make Feature Layer" tool), selecting the first BlockId in the Feature Layer and then executing a nested subset selection (SUM_SourceHa=(SELECT MAX( SUM_SourceHa) FROM TestSource_Dissolve)) on the records for that Block to find the instance with the maximum area. Then I simply use that selection to calculate the Species value across to the SpeciesSelect field. The problem is that it calculates this for the first iteration, but not thereafter.

I suspect it’s holding on to the first selection somehow and when it runs the second time, nothing is selected when it’s looking for Block A2 inside the initial selection for A1 and then it gives me the green error saying that it’s empty when it tries to select the maximum. As you can see, I’ve even tried to add the "Clear Selection" operation, but it’s got no affect. Strictly speaking I shouldn’t have to do that as it’s a new selection on each iteration, but I thought it won’t hurt.

What am I missing?

enter image description here

enter image description here

[1]: https://i.stack.imgur.com/F0934.png

One Answer

Your subselect is not honouring the selection you imposed based upon block number, so the maximum value is always 21.767.

I would suggest the following workflow. First create a separate summary table summarizing by block ID and MAX Sum_SourceHA as shown below. Do not be tempted to include this in the model as it only needs to be constructed once.

Summary table

Then use this model:

Model

The expression in the single select tool is:

block = '%blockid%' AND SUM_SourceHA = %maxvalue%

The result is:

results

Note the selection existing on the final loop, so you may want clear that or simply ignore it?

Correct answer by Hornbydd on August 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP