2

I am a little stuck with a relatively simple model.

What I want:

1) Create a table "results".

2) Loop over "Points".

3) Do some buffer and counting

4) Put the results (OBJECTID and count) into "results" via "addRecord"

5) Goto 2

What it does: 1) -> 2) -> 3) -> 4) and then it creates "results" again which somehow empties results.

Any hints ?

addRecord looks like this:

   import arcpy

   infile = arcpy.GetParameterAsText(0)
   IDFieldValue = long(arcpy.GetParameterAsText(1))
   CountFieldValue = arcpy.GetParameterAsText(2)

   rows = arcpy.InsertCursor(infile)

   row = rows.newRow()
   row.setValue("OID", IDFieldValue)
   row.setValue("count", CountFieldValue)
   rows.insertRow(row)

   del row
   del rows

enter image description here

3

You need to separate your model into two models. As you have it now, the results table gets created with every iteration. Step 1 needs to be in separate model that calls a sub model, which performs the rest of the steps. Refer to this help file on how to set up nested models.

1
  • Thanx - couldn't really make it work - problems with preconditions. Ended up coding it in python :) Let me know if someone wants to see the code. Nov 12 '14 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.