Possible Duplicate:
Iterative position within Field Calculator/Python

I need to calculate a field for a data set that is grouped by county. At each change in county I need the column to start from 1 and progress up until the end of the county group and then start over.

  • Can you please provide more detail? i.e. version, and maybe a screenshot of the dbf? – Emily Apr 20 '12 at 15:17
  • Please be more descriptive -- I don't follow the "at each change in county I need the column to start from 1 and progress..." – Roy Apr 20 '12 at 15:20
  • So I have a large set of grids that overlay each county and there is a column named 'County' with the name of that county. There is a column named 'Tile' that needs to start at the integer '1' and each new grid would progress by +1 until the end of the county group. Then the next county group would start over at '1' and progress by +1. – Andy Apr 20 '12 at 15:20
  • This is very similar to this question: gis.stackexchange.com/questions/22751/… – Stev_k Apr 20 '12 at 15:30
  • Thank you for pointing me to that. I looked and must have passed over this. – Andy Apr 20 '12 at 15:32

Using Python in the field calculator is really best for very simple operations. Any time you have to change values based on a field, it gets a bit too complicated for my liking. You might want to script it instead using cursors

| improve this answer | |

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