3

I'm trying to get the maximum numeric value from one feature class and use that value in an expression to calculate values of a different feature class.

fc2.bldg_id = max(fc1.bldg_id)+1

Can this be done using the advanced field calculator? If so, what would my syntax look like? Do the feature classes need to be in the same fgdb and feature dataset?

1 Answer 1

2

I would do this one using ModelBuilder.

The model would first use the Summary Statistics tool to create a table with a single row for the Maximum of your bldg_id from fc1.

To read that value into a variable called Value use the Get Field Value tool (new at ArcGIS 10).

You can then use a Calculate Field tool on the bldg_id field of fc2 with its Expression set to %Value% + 1. Make the Value variable a precondition to running the Calculate Field tool.

3
  • I'll have to play with that at 10. I resorted to keeping track of the max(bldg_id) on paper. Thanks.
    – Greg
    Commented Apr 19, 2011 at 12:21
  • Is there a way to accomplish that in 9.3?
    – mlt
    Commented Jun 10, 2013 at 16:22
  • Yes - the Get Field Value tool was not available until 10.0 but at 9.3.1 (presumably 9.3 too) it was possible to write a fairly succinct Python Script Tool that opens a SearchCursor to read the row value you are interested in. This tool could be used in ModelBuilder too.
    – PolyGeo
    Commented Jun 11, 2013 at 11:08

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.