<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Field Calculation Between Two Feature Classes in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261258#M8955</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Mark,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For rows in the same table you can use a search cursor to iterate through and get the required value for each field:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if there are only 2 records in your table you could quickly use 2 search cursors with a where clause to get the required row values...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

fc = "c:/...your featureclass"
use_field = "UseClass"
length_field = "SUM_SHAPE_Length"

# Create an expression with proper delimiters
#
a1expression = arcpy.AddFieldDelimiters(fc, Use_field) + " = A1"

with arcpy.da.SearchCursor(fc, (use_field, length_field),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause=a1expression) as a1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in a1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a1value = row[1]

d1expression = arcpy.AddFieldDelimiters(fc, Use_field) + " = D1"

with arcpy.da.SearchCursor(fc, (use_field, length_field),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause=d1expression) as d1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in d1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d1value = row[1]

## you can then use a1value and d1value in an if statement to calculate the percentages in the same way as field calculator

if d1value &amp;gt; (a1value * .2):
&amp;nbsp;&amp;nbsp; print "more than 20%" ## if you are running as a script tool then use arcpy.AddMessage("more than 20%")
elif d1value &amp;lt; (a1value * .2):
&amp;nbsp;&amp;nbsp; print "less than 20%" ## if you are running as a script tool then use arcpy.AddMessage("less than 20%")
elif d1value == (a1value * .2):
&amp;nbsp;&amp;nbsp; print "exactly 20%" ## if you are running as a script tool then use arcpy.AddMessage("exactly 20%")
else:
&amp;nbsp;&amp;nbsp; print "invalid calculation - please check inputs and try again"

del a1value, d1value, a1cursor, d1cursor, a1expression, d1expression, row, use_field, length_field, fc&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this makes sense - I have just typed as thought and not checked at all so might need some syntax corrections but hope it gives you the right idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:49:35 GMT</pubDate>
    <dc:creator>TimDonoyou</dc:creator>
    <dc:date>2021-12-11T12:49:35Z</dc:date>
    <item>
      <title>Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261254#M8951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a feature class containing two summed values (two attributes). I need to find out if one is less than or more than 20% of the other.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to field calculate this in the same feature class? I have tried to export to two separate feature classes but cannot see a tool to call different fields from different feature classes in the same calculation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 08:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261254#M8951</guid>
      <dc:creator>MarkYoung</dc:creator>
      <dc:date>2013-10-02T08:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261255#M8952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can create a new field and then use the field calculator, via python, using if statements to return values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e. if it is more than 20% return 1, if it is less than 20% return 2 and if it is exactly 20% return 3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would then be able to use this field identify what you need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm sorry I can't help you with the code, but you maybe should ask in the python forum here to get the code you need. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this is not exactly what you want to hear, but I'm just letting you know it is possible &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 11:54:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261255#M8952</guid>
      <dc:creator>TimWitt</dc:creator>
      <dc:date>2013-10-02T11:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261256#M8953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Mark,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Tim is correct, you can do this in the field calculator. Sample input in attachment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Where FID_1 is your compare to value, and FID_2 is the value to be compared. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A simple python function called Percent is fed the 2 values, and 3 if statements decide how to proceed based on the comparison outcome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If it is more than 20% return 1, if it is less than 20% return 2 and if it is exactly 20% return 0 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 12:14:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261256#M8953</guid>
      <dc:creator>JimCousins</dc:creator>
      <dc:date>2013-10-02T12:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261257#M8954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks you for the code. However the values I want to compare are in the same field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27966[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 15:21:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261257#M8954</guid>
      <dc:creator>MarkYoung</dc:creator>
      <dc:date>2013-10-02T15:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261258#M8955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Mark,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For rows in the same table you can use a search cursor to iterate through and get the required value for each field:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if there are only 2 records in your table you could quickly use 2 search cursors with a where clause to get the required row values...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

fc = "c:/...your featureclass"
use_field = "UseClass"
length_field = "SUM_SHAPE_Length"

# Create an expression with proper delimiters
#
a1expression = arcpy.AddFieldDelimiters(fc, Use_field) + " = A1"

with arcpy.da.SearchCursor(fc, (use_field, length_field),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause=a1expression) as a1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in a1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a1value = row[1]

d1expression = arcpy.AddFieldDelimiters(fc, Use_field) + " = D1"

with arcpy.da.SearchCursor(fc, (use_field, length_field),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause=d1expression) as d1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in d1cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d1value = row[1]

## you can then use a1value and d1value in an if statement to calculate the percentages in the same way as field calculator

if d1value &amp;gt; (a1value * .2):
&amp;nbsp;&amp;nbsp; print "more than 20%" ## if you are running as a script tool then use arcpy.AddMessage("more than 20%")
elif d1value &amp;lt; (a1value * .2):
&amp;nbsp;&amp;nbsp; print "less than 20%" ## if you are running as a script tool then use arcpy.AddMessage("less than 20%")
elif d1value == (a1value * .2):
&amp;nbsp;&amp;nbsp; print "exactly 20%" ## if you are running as a script tool then use arcpy.AddMessage("exactly 20%")
else:
&amp;nbsp;&amp;nbsp; print "invalid calculation - please check inputs and try again"

del a1value, d1value, a1cursor, d1cursor, a1expression, d1expression, row, use_field, length_field, fc&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this makes sense - I have just typed as thought and not checked at all so might need some syntax corrections but hope it gives you the right idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:49:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261258#M8955</guid>
      <dc:creator>TimDonoyou</dc:creator>
      <dc:date>2021-12-11T12:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261259#M8956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tim,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for the code! I copied the code to a txt file, renamed txt file to .py then aded as a script to the model - is that correct?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems to run OK but nothing seems to be updated (I specified the file path to my feature class) do I need to set field parameters when importing the script?. I have ran out of time this week but shall investigate on Monday.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261259#M8956</guid>
      <dc:creator>MarkYoung</dc:creator>
      <dc:date>2013-10-03T14:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261260#M8957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;no worries mark - if you are working in arcmap then in the first instance I would just run the code line by line in the python window:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000017000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000017000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you can then copy my code statement by statement into this, hit return after each line and see if it runs ok - you'll get red error messages if it doesn't which will help to resolve any issues - there might be a couple.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when you have fixed all the niggles and run it a few times then you can save it as a python script, add to a toolbox and define your input/output parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 15:50:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261260#M8957</guid>
      <dc:creator>TimDonoyou</dc:creator>
      <dc:date>2013-10-03T15:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261261#M8958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;no worries mark - if you are working in arcmap then in the first instance I would just run the code line by line in the python window:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000017000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000017000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;you can then copy my code statement by statement into this, hit return after each line and see if it runs ok - you'll get red error messages if it doesn't which will help to resolve any issues - there might be a couple.&lt;BR /&gt;&lt;BR /&gt;when you have fixed all the niggles and run it a few times then you can save it as a python script, add to a toolbox and define your input/output parameters:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;&lt;BR /&gt;Tim&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it looks like he wants you to rewrite the script to use an update cursor.&amp;nbsp; As far as I can tell, all your script does is read the table and print to screen, but he does not want that.&amp;nbsp; He wants it to actually change a field value somewhere and does not know how to adapt the script to do that.&amp;nbsp; I am not sure what field or table he wants to update, so I think he needs to provide more information about his end goal.&amp;nbsp; But I am sure he wants the script to actually do the update for him like a field calculation would.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 16:12:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261261#M8958</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-10-03T16:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261262#M8959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi,&lt;BR /&gt;Thanks you for the code. However the values I want to compare are in the same field.&lt;BR /&gt;Thanks&lt;BR /&gt;Mark&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]27966[/ATTACH]&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Consider the following, especially in light of the fact Jim posted field calculator code following Tim's suggestion and since this is not the Python forum.&amp;nbsp; You'll have to experiment, but the tool Pivot Table may help support that solution, review this webhelp:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pivot Table (Data Management) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop » Geoprocessing » Tool reference » Data Management toolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000n8000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000n8000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It appears (on initial inspection of what you provided) you may be able to utilize a table format where instead your field headers are values from what is currently your UserClass field i.e. 'A1, 'D1', etc... and your sum_shape_length values would then be accessible to you for further processing via the field calculation mentioned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in effect, UserClass is your 'pivot field', sum_shape_length is your 'value field', and since your 'input fields' determine what makes your records unique and it appears you do not need to summarize further to 'flatten' the table so to speak, I believe you can just specify your source table unique identifier (OBJECTID or similar field).&amp;nbsp; See the illustration at the top of the webhelp page - again, experiment...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once you have that (I imagine this intermediate step is quick), you can ask Jim if he's still available to post his full code block from his illustration...or someone else can do that, no problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 19:11:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261262#M8959</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-10-03T19:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261263#M8960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was looking at some of the toolbox tools again that I've been meaning to test, some are new to me, and experimented further with the Pivot Table tool (in the Table toolset of the Data Management toolbox) and I need to clarify something about my last post, so bear with me below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed that in your attached picture you only had 2 fields and 2 records.&amp;nbsp; Well you can in fact use the Pivot Table tool on this although usually you'd probably run it on more...it works pretty much the same.&amp;nbsp; Take for instance this 2 record input:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28032[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This, if you cannot already tell, is a summary table of area based on SUBDIVISIO (other fields not important at this time).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I did not mention earlier is the Pivot Table tool requires at least 1 input field, so I've simply added a dummy field (called dummy) and coded it for both records to 1 (the value doesn't matter).&amp;nbsp; So, then running a Pivot Table execution with the SUBDIVISIO field as the pivot field and the SUM_Shape_Area the value field, you get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28028[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...which I think is what you were after in the beginning to run the field calculator on to compare area values, correct?&amp;nbsp; Now, without knowing how you arrived at this point in the processing is kind of irrelevant at this point, to you anyway.&amp;nbsp; I would likely also employ the search/update cursor approach because that is likely easier for me....but the important thing here is that you have an option!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OK, so this is basically how the tool interface looks, notice the entered input, pivot, and value field params:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28029[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, to impress upon you the likely 'normal' mode you'd be using this tool, possibly in the future, here are successive analogous pics of the multiple record processing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28030[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This time I want to use an input field, C1...it'll be clear in a moment why...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28031[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now does it make sense?&amp;nbsp; I now have 3 records summarized by G, M, Q - no idea what these are, just codes to me just like the ones you have presented - all that matters is they are unique).&amp;nbsp; The input values specified are again summarized by SUBDIVISIO that are values side-by-side...incidentally values that I could now compare via the field calculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this drill helps you...I hope I have adequately explained, and if not just let me know, please.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for that, I learned something new today.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 23:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261263#M8960</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-10-03T23:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261264#M8961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you all for your detailed responses. Unfortunately the Pivot Table tool is only available in with an ArcInfo or advanced license as its now called and I only have ArcEditor. Very frustrating!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is some more information on my problem or end goal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a line feature class in a file geodatabase which has two relevant fields, [Use_Class] and [Shape_Length]. There are various different types of Use classes. The use classes relate to commercial buildings and what they are being used for - their use class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In particular there is a use class called A1. It is this A1 use class that I need to compare all other use classes to; all other use classes must not exceed 20% of the total length of A1 use class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The user selects (parameter input) the various lines be they A1, B1, C1 D1, etc and the script dissolves based on the use class value giving the summed result or total length by use class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now what I want to do is select all use classes not equal to A1 and sum those values. Once summed I wish to check that that summed value is not greater than 20% of the summed A1 value. I am having difficulty doing this as the data to query is in the same field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope all that makes sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 12:13:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261264#M8961</guid>
      <dc:creator>MarkYoung</dc:creator>
      <dc:date>2013-10-07T12:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261265#M8962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, by the sound of your problem, it doesn't seem that difficult...let's cover the math 1st, if this is correct:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Say you have 2 numeric values, represented by A and B, with A being the smaller of the two.&amp;nbsp; A divided by B should give you basically a proportion or percentage (if you multiply by 100) of what A is relative to B.&amp;nbsp; Then all you'd really need to do to identify records less than a 'threshold' value (which you said is 20%) is simply to select what result is either under (&amp;lt; 20%) or over (&amp;gt; 20%).&amp;nbsp; ...from there of course you could calculate a field if you wanted one to record 'yes' or 'no' (true or false) whether the result meets your criteria.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sound on course so far??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 12:33:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261265#M8962</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-10-07T12:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261266#M8963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes that's what I am looking for&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 12:38:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261266#M8963</guid>
      <dc:creator>MarkYoung</dc:creator>
      <dc:date>2013-10-07T12:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261267#M8964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, if your data is what I think it is, you could select the records for the single type you want to run the calculation against, from the open table right-click on the area field and get the summary stats (this dynamic tool is denoted by the sigma sign, I believe), so that (if you don't already have the sum figure) you will then have a sum of the area of those selected records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could copy this figure, create a new numeric field and (conceivably) calculate the division by 'hard-coding' this value in the field calculator expression.&amp;nbsp; Of course it is not necessary to calculate the records from which you got the sum figure, so you could 'switch selection' before you run the calc.&amp;nbsp; Make sense?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It may help if you attach a more representative table of your data...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 13:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261267#M8964</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-10-07T13:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261268#M8965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Mark, I was very much interested in how you could do this without scripting and without any of the advanced tools -- and after I read your posts today, I think there's a fairly direct solution with a model (ModelBuilder).&amp;nbsp; See this graphic first:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28105[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now let me make sure I understand what basic proportion figure you want - is it correct that for every summary value by type, you want to compare this value with the remaining values, ie divide by the sum of the remaining values?&amp;nbsp; (Then, of course, if that is the case multiplying by 100 yields percentage.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not very good with ModelBuilder but managed to put together in 10.1 a model with a companion map and file gdb, everything is relative-pathed, so you should be able to save the zip to your local drive somewhere, open the map provided and run the model - you should be able to open the model in edit mode to see how it works.&amp;nbsp; If for some reason it doesn't work or not as expected, let me know.&amp;nbsp; For me, it was mainly a matter of understanding how ModelBuilder handles model params and in-line variable substitution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any questions, please fire away.&amp;nbsp; The expression which I placed as a label at the bottom of the graphic is, I suppose, the most important part...the Get Value tool was interesting, a little trick on the 2nd summary stat execution to simply fetch the grand total area value of the single output record.&amp;nbsp; I guess not everything had to be a 'hard output' to the gdb provided, but maybe helps to see what's going on.&amp;nbsp; The hab60 is a provided input layer with a Type1 field - this is summarized out to 3 types to sum polygon areas (you can adapt it very easily to line lengths).&amp;nbsp; The 2nd summary already mentioned is for the total - Calculate Value or Calculate Field with a python expression could have done this too, but my objective was to either do it all in Python or all in ModelBuilder ---- because I'm a glutton for punishment I suppose.&amp;nbsp; (Just kidding, I just didn't want to unnecessarily introduce any Python in this forum.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps, certainly I needed a better handle on in-line var sub - and also the ability to troubleshoot better some, well, monstrous models....perhaps?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, didn't include a ReadMe file...if you really need one I'll see what I can do.&amp;nbsp; It appears the initial attachment was too large, it was the gdb, so I've greatly reduced it, and it successfully uploaded.&amp;nbsp; The added 'test' field in the summary table added to the TOC of the map should result in the 3 records where the added field is updated (the overwrite property in Geoprocessing Options should be turned on) --- results (in percent) may be a little ridiculous, but accurate given the sample set.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 23:11:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261268#M8965</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-10-07T23:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculation Between Two Feature Classes</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261269#M8966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for all your help. I took your model and customised it for my needs. Instead of using the stats tool I used the dissolve tool as I need to create a spatial table rather than just a 'flat' table. One difficulty I had was how to join the two tables. I overcame this by cheating a bit. I simply assigned a new field to the nonA1 use class table and calculated the value to be A1 just to join the table. I could then run field calculations based on fields within the same table. (the end user does not see this processing)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also added in a field to say if the result of the non A1 use class is more or less than 20% of the A1 Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If [SUM_SHAPE_Length] &amp;lt; [Non_A1_Percentage] Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Output = "Less Than 20%"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ElseIf [SUM_SHAPE_Length] &amp;gt; [Non_A1_Percentage] Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Output = "More Than 20%"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Results=&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Output&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My model is probably not the slickest but it gets the job done and I have attached as a graphic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Again thank you (and to others) for all your help with this as it automates a large part of the end users' task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28112[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Oct 2013 10:12:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calculation-between-two-feature-classes/m-p/261269#M8966</guid>
      <dc:creator>MarkYoung</dc:creator>
      <dc:date>2013-10-08T10:12:14Z</dc:date>
    </item>
  </channel>
</rss>

