1

I need to invert the fields of an attribute table relative to the row ID field. As a very simple example of what I need; if the row IDs of 1, 2, and 3 corresponded to identical values in another field, I would need these values to be reordered so that the row IDs of 1, 2, and 3, corresponded to the inverted values of 3, 2, and 1, respectively. This is part of a model I am making so I cannot do this manually, I need some way of doing this using ArcGIS tools in modelbuilder.

I am using ArcGIS 10.2

4 Answers 4

3

Assuming that the numbering of your rows always starts at 1 and proceeds with increments of 1 to a different number each time I think your model/code needs to do this:

  1. Use GetCount to count the number of rows (numRows)
  2. Use Calculate Field to do (numRows - ID) + 1
0

You can do this easily by using the sort tool.

This tool reorders, in ascending or descending order, records in a feature class or table based on field values. The reordered result is copied to a new dataset.

1
  • Thank you, I neglected to mention that I am using a Raster dataset, so this method will not work. sorry about that.
    – jc22
    Commented Oct 10, 2014 at 13:44
0

Okay, I found my own solution:

  1. Make a new table which contains a field with values identical to those of a field in the original table and another in which these values are in reverse order

  2. Copy this new table

  3. Join the field(s) you wish to flip to the new table, using the field which is reversed in the new table as the output join field, and the reversed field itself as the input join field

Give a new field in the new table the exact values of the joined field (just to change the name)

  1. Join the field back to the original using the correctly ordered fields in each table as the input and output fields
0

Add Field calculate, select function helper in the filter, click sequential number in the box, change pStart to the last record number in the attribute table. Change pInterval to -1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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