Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I got table like that one (Example).

I need to change 0 to 1 and -1 to 0 in each field except first and second.

The problem is that every time i have different number of fields and field name is changed too, but i can use wildcard "FID_" to select a field name.

I read some stuff about, should be like that:

 def test(
  fieldList = ListFields(%path%)
  for field in fieldList:
    if (
    return EQ

%path% should be the value taken from model-builder (if that is possilbe).

share|improve this question
If your preference is ModelBuilder, think about Iterators and Model Only Tools like Calculate Value, or if it is Python/ArcPy, then I think you will need to use getValue and setValue. – PolyGeo Sep 26 '12 at 11:06
Why not just do this in field calculator? You could use the same snippet in each field and skip modelbuilder all together. – Roy Sep 26 '12 at 11:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.