nested loops / cursors ?

243
1
07-07-2010 08:16 AM
BKS
by
Occasional Contributor
I need to get some confirmation on what is possible in terms of cursors and nested loops with python geoprocessing scripts in 9.3.1 and/or 10.

1) Is it possible to process two UNrelated tables with nested loops such that the outer loop processes one table with a cursor and inner loop processes another table with a separate cursor?

2) Same question but... tables are related and second recordset for inner loop is defined on each iteration of the outer cursor using a value from a field in the outer cursor?

3) Given scenario in question 2 above, would it be better to join the related tables such that all records are returned into a single recordset with one cursor?

Brian
0 Kudos
1 Reply
ChrisMathers
Occasional Contributor III
I dont know about related tables but I know that you cant use an update cursor on a joined table. So on that basis,

1=Yes
2=No
3=Proabably best if un-related thought numbingly slow if your tables are large.

I would make some test shapefiles with a few features each and try both methods. Thats the quickest way to test this.
0 Kudos