<?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: Formula differences in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/formula-differences/m-p/407996#M32159</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Py is case sensitive so "Int" should be "int".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then in your 2 calculation statements you a have mismatch in the brackets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried testing this in the python ide directly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;N&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Sep 2012 12:20:19 GMT</pubDate>
    <dc:creator>NeilAyres</dc:creator>
    <dc:date>2012-09-27T12:20:19Z</dc:date>
    <item>
      <title>Formula differences</title>
      <link>https://community.esri.com/t5/python-questions/formula-differences/m-p/407995#M32158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcGIS 9.3.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attempting to calculate a field with a specific formula, which actually works correctly when I plug it into the FieldCalculator in ArcGIS 9.3.1 --- however, I am getting a different result when I place the formula into a Python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: "fff" is just a field that holds an incremental value starting at 1.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works in the Field Calculator:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;40 - (Int(( [fff] - 1) / 35) + 1) + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My attempt to calc the field in the script is like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;rowsr = gp.UpdateCursor(outLabelsFC) rowr = rowsr.Next() i = 1 while row: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowr.setvalue("row", (40 - ((rowr.fff - 1) / 35) + 1) + 1) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowsr.updateRow(rowr) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowr = rowsr.Next() &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python doesn't like the "Int", so I have tried:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;40 - ((rowr.fff - 1) / 35) + 1) + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;40 - (long((rowr.fff - 1) / 35)) + 1) + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both of the above generate a different result from run in the field calculator.&amp;nbsp; Can you help explain why or what I am missing here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 11:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/formula-differences/m-p/407995#M32158</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2012-09-27T11:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Formula differences</title>
      <link>https://community.esri.com/t5/python-questions/formula-differences/m-p/407996#M32159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Py is case sensitive so "Int" should be "int".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then in your 2 calculation statements you a have mismatch in the brackets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried testing this in the python ide directly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;N&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 12:20:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/formula-differences/m-p/407996#M32159</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2012-09-27T12:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Formula differences</title>
      <link>https://community.esri.com/t5/python-questions/formula-differences/m-p/407997#M32160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Py is case sensitive so "Int" should be "int".&lt;BR /&gt;Then in your 2 calculation statements you a have mismatch in the brackets.&lt;BR /&gt;Have you tried testing this in the python ide directly.&lt;BR /&gt;Cheers,&lt;BR /&gt;N&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, Neil.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I simply needed to change Int to int.&amp;nbsp; Jumping from C#.NET/VB.NET to Python (I am new to Python) and creating Geoprocessing objects has been interesting.&amp;nbsp; Simple things can really trip you up and seem to be quite difficult to pickup for some reason!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 12:30:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/formula-differences/m-p/407997#M32160</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2012-09-27T12:30:26Z</dc:date>
    </item>
  </channel>
</rss>

