Stop/Continue in nested submodel (with iterators)

598
3
09-16-2011 12:53 PM
HeatherCarlos
New Contributor III
Hello all!
I have a frequency table with a with a bunch of different attributes (destinations).  I want to iterate through the rows of the table, and then check that a select list of the attributes have a value >0, if so, I then want to make a selection from a related shapefile and draw a convex hull around the selection.  If any of the list of attributes = 0, then I do nothing and move on to the next row of the frequency table.

To do this, I set up a submodel with iterate field values and calculate value to check the list of attributes.  I use "stop" if one of the attributes = 0, otherwise continue.  In the main model, I Iterate Row Selection on the frequency table and then send the selected row to the submodel.  I then have the results of the submodel (the "continue") as a precondition for selecting from the shapefile and drawing the convex hull.

Two problems:  1) my calculate value always returns "true" even if the attribute = 0
2) Even when the submodel finds all the attributes > 0, the next step in the main model won't run because "the precondition is false".

I've attached the model, submodel the calculate value code is as follows:

getVal("%DestName%")

def getVal(intValue):
  if intValue >= 1:
    return "TRUE"
  else:
    return "FALSE"

Data Type is Boolean
0 Kudos
3 Replies
by Anonymous User
Not applicable
Original User: shitijmehta

I see that you are using iterators in both the main model and the sub-model.

Can you share your model for me to suggest a solution? I need to see each tool dialog to understand what the model is doing.
0 Kudos
HeatherCarlos
New Contributor III
I've attached a zipfile of the toolbox with both the model and submodel.

I think one of my problems is that I'm not feeding the frequency table into Calculate Value (I don't even have it in the submodel). But I'm not sure how to get Calculate Value to know that is the table I want it to calculate from.

I've also tried using Get Field Value - but I am running into a problem with the default iterator value of 1 - I posted in another thread about this.

Thanks,
Heather
0 Kudos
by Anonymous User
Not applicable
Original User: shitijmehta

Hi Heather,

I did take a look at your model and the organization of your model is not quite correct. Using Iterator in the main model and another iterator in sub-model will create a lot of problems in terms of input. I think you just need one simple model.

What are you trying do through the model?
What is your starting data?
What do you want in the end?

From what I understand you want to use the data NC_1_Freq /NC_1_SpatialJoin to select everything greater than 1 and then make a minimum bounding polygon for those selected features.
If this is correct?

If yes,
All you need to do is use a Select/Select Layer By Attribute tool upfront, make a selection of features greater than 1 and then minimum�?�.
0 Kudos